ios - 从 UITableView 获取 "Pull to Refresh"的最佳方法是什么?

标签 ios objective-c uitableview swipe

我有一个 UITableView ,并显示从连接 WiFi 的设备接收到的数据。

我想执行相当糟糕的标准手势响应,即向下拖动表格,然后释放它,以触发更新。

我想我可以将滑动手势识别器附加到表格的底层 View ,但我想知道是否有办法直接从表格本身拦截此手势。

META:

I've been looking through the various docs and whatnot. I haven't had to do this before, so I never gave it any thought. Now I see that I probably should have thought about it.

If this is an obvious solution, I don't mind being told so, as long as you help me to find the "obvious" remedy. I'll delete this question if it's a bad one.

However, I haven't found a solution, and I'm usually fairly good at that kind of thing.

UPDATE I changed the title to better reflect what I'm asking.

最佳答案

完全原生的方法是在您的 UIViewController 中使用 UITableViewController,例如

{
    tableViewController = [[UITableViewController alloc] init];
    [tableViewController setTableView:myTableView];

    refreshControl = [[UIRefreshControl alloc] init];
    [tableViewController setRefreshControl:refreshControl];
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
}

关于ios - 从 UITableView 获取 "Pull to Refresh"的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28768534/

相关文章:

ios - @property copy 与 readonly 结合使用是否有意义?

c# - 在 MonoTouch 中的 View Controller (缓存数据)之间传递数据的最佳方式

iphone - 如何为 cocos2d 创建倒数计时器?

iphone - 延迟加载缩略图

ios - 重置按钮操作的 UITableViewCell 复选标记

ios - 使用分页符编辑 NSString

ios - 苹果可以在我的应用程序中批准信用卡表格吗?

ios - 使用 TableViewCell IndexPath 值执行 segue

ios - 将设备旋转为横向时的 UICollectionViewFlowLayout 大小警告

objective-c - iOS5 : UITableView poor scrolling performance