ios - 如何将刷新控件应用于 UITableView

标签 ios objective-c

有没有办法将刷新控件应用于 UIViewController 中设置的 UITableView

我找到的解决方案需要 UITableViewController 的子类化,这对我来说很麻烦,因为我需要子类化 UIViewController 而不是 UITableViewController,并且我在 UITableView 的文档下没有看到任何允许我在其上设置刷新控件的方法。

任何帮助将不胜感激!

最佳答案

使用这个 UIRefreshControl 控件:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh1:) forControlEvents:UIControlEventValueChanged];
[Delivered_TBL addSubview:refreshControl];


- (void)refresh1:(UIRefreshControl *)refreshControl
{
    [self Service_Call];
    [refreshControl endRefreshing];
}

关于ios - 如何将刷新控件应用于 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31202717/

相关文章:

ios - 如何编译 iOS 应用程序 (IPA) 以通过 Microsoft Intune 分发它

iphone - 从 iphone 的核心数据中删除对象时应用程序崩溃

ios - 在 iOS 上创建 Mapbox map View 的快照?

ios - 当搜索栏仍处于焦点状态时,如何在 .searchable 上关闭键盘? [SwiftUI]

objective-c - 对齐不同大小的图像

objective-c - 无法在 NSTableView 中进行空选择

ios - UICollectionView 中的单元格左对齐

iphone - 使用 ObjectiveC/iPhone 中的 TwitPic API

ios - 有什么方法可以禁用iOS市场版本中所有抛出的异常?

ios - Spritekit PhysicsBody applyTorque