ios - 如何将 "pull to refresh"添加到 tableView,而不是 UITableViewController?

标签 ios objective-c uitableview uirefreshcontrol

<分区>

我有 viewController,还有一个 tableView,我想在其中添加拉动刷新,但它没有 propertyrefreshConroller,我需要做什么?

最佳答案

关于您的信息,Apple 不会在其对象库中发布 refreshControl。 您只需使用几行简单的代码即可添加:

UIRefreshControl *refresher=[[UIRefreshControl alloc] init]; 
[refresher addTarget:self
              action:@selector(refreshData)
    forControlEvents:UIControlEventValueChanged];

[tableView addSubview:refresher];

refreshData 是你的目标方法,在那里你可以做任何你想做的事。

关于ios - 如何将 "pull to refresh"添加到 tableView,而不是 UITableViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24581995/

上一篇:ios - 我可以将屏幕区域与 UI 自动化脚本中的引用图像进行比较吗?

下一篇:ios - Ruby on Rails - 使用移动客户端进行用户身份验证

相关文章:

ios - 从 Moya 请求生成 cURL 输出?

iphone - 从不同线程访问 UIView 的简单快捷方式

ios - ViewController 在 didSelectRowAtIndexPath 中缓慢呈现

ios - Swift:如何将函数类型值设置为可选变量?

objective-c - 通过 MPMediaPickerController 选择音频

ios - 数组为空时的错误处理

ios - 当某些情况发生时如何停止插入segue?

ios - TableView 的渐变

iOS : Transfer Scroll Gesture on a View to Another

ios - 如何在全局函数中使用 AppDelegate 快速在主线程上执行选择器?