【问题标题】:Proper pull to refresh适当拉动刷新
【发布时间】:2014-05-04 18:15:26
【问题描述】:

是否有任何工作拉动来刷新库?

PullToRefresh-master 不起作用

SVPullToRefresh-master 有错误

ODRefreshControl-master - 不像我想要的那样

【问题讨论】:

  • 向我们展示您的代码以便我们提供帮助

标签: ios pull-to-refresh


【解决方案1】:

有很多可用的库,但我建议您使用UIRefreshControl。 Apple 在 iOS6 中引入了 UIRefreshControl。您可以使用

将它集成到您​​的 UITableViewController 中
- (void)viewDidLoad {
    [super viewDidLoad];
    // Initialize Refresh Control
    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    // Configure Refresh Control
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    // Configure View Controller
    [self setRefreshControl:refreshControl];
}

refresh: 方法将触发更新,您可以使用以下方法在 API 回调中停止更新:

 [(UIRefreshControl *)sender endRefreshing];

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-05
  • 1970-01-01
  • 2020-12-02
  • 2020-07-07
  • 2020-09-23
相关资源
最近更新 更多