【问题标题】:Changing the position of the DragRefreshView in the three20 library改变DragRefreshView在three20库中的位置
【发布时间】:2010-07-21 16:37:16
【问题描述】:

我正在为一个 iPhone 项目使用 three20 库。作为其中的一部分,我在 tableview 上使用 pull 来刷新(如 fb 和 twitter)。它工作得很好,但是如果它位于 tableview 的底部会更好。

我看不到任何明显的配置设置来执行此操作(基本上没有 API 文档),所以我已经挖掘了一下,看起来我必须推出自己的 TTTableViewDragRefreshDelegate 实现

我找到了添加实际拖动按钮的代码(删除了不相关的位):

- (id)initWithController:(TTTableViewController*)controller {
    if (self = [super initWithController:controller]) {
        // Add our refresh header
        _headerView = [[TTTableHeaderDragRefreshView alloc]
                      initWithFrame:CGRectMake(0,
                                                -_controller.tableView.bounds.size.height,
                                                _controller.tableView.width,
                                                _controller.tableView.bounds.size.height)];
        _headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        _headerView.backgroundColor = TTSTYLEVAR(tableRefreshHeaderBackgroundColor);

        [_controller.tableView addSubview:_headerView];
}

但是我对在代码中移动视图内容非常缺乏经验,所以我不确定从哪里开始。有什么想法吗?

【问题讨论】:

    标签: iphone objective-c three20


    【解决方案1】:

    您是否尝试将其添加到页脚而不是将其添加到 UITableView 的页眉中?

    您可以通过self.tableView.tableFooterView 访问此内容..不过有一个警告:我没有使用three20 代码尝试过此操作,他可能正在检查用户是否正在滚动到顶部然后刷新表格。你必须自己多研究一下。您可能还需要弄乱框架以使其看起来正确(不是在我的笔记本电脑上,否则我可以提供更多帮助)。

    尝试将您的代码更改为:

    [_controller.tableView.tableFooterView addSubview:_headerView];
    

    更多信息在这里:http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-17
      • 1970-01-01
      • 1970-01-01
      • 2012-10-31
      • 2014-07-11
      相关资源
      最近更新 更多