【问题标题】:Programmatically show TTTableHeaderDragRefreshView's Pull Down to Update Message以编程方式显示 TTTableHeaderDragRefreshView 的下拉更新消息
【发布时间】:2011-12-02 07:53:10
【问题描述】:

如何使用three20 的TTTableHeaderDragRefreshView 以编程方式显示此消息? (虽然这个例子不是来自three20)

我可以控制滚动以滚动到顶部带有一点负 y 值,只是为了显示该消息:“下拉以更新/刷新?”

【问题讨论】:

    标签: ios uitableview ios5 three20


    【解决方案1】:

    是的,您必须手动更改表格的内容偏移量并调用表格的重新加载功能。这将创建用户在尝试通过滚动到表格顶部来更新内容时看到的相同效果:

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    - (void)reload {
      if ([self.tableView.delegate isKindOfClass:[TTTableViewDragRefreshDelegate class]]) {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:ttkDefaultFastTransitionDuration];
        self.tableView.contentOffset = CGPointMake(0, -60.0f);
        [UIView commitAnimations];
      }
    
      [super reload];
    }
    

    然后,只需添加一个按钮即可使用此重新加载功能:

    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reload)] autorelease];
    

    您可能还需要使数据源无效,以强制更新,因为如果数据存储在缓存中,刷新的拖动将立即出现并隐藏。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多