在我的UIViewController
中,我有一个UITableView
作为子视图之一。添加我UIRefreshControl
用下面的代码:iOS - UITableView的UIRefreshControl与UITableViewController的UIRefreshControl
// enable "pull to refresh"
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull To Refresh!" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : [UIFont systemFontOfSize:17]}];
[refreshControl addTarget:self action:@selector(fetchArticles) forControlEvents:UIControlEventValueChanged];
refreshControl.backgroundColor = [UIColor colorWithRed:0.0f/255.0f green:102.0f/255.0f blue:153.0f/255.0f alpha:1.0];
refreshControl.tintColor = [UIColor whiteColor];
self.refreshControl = refreshControl;
[self.tableView addSubview:self.refreshControl];
我在我的应用程序的另一个屏幕,采用的是UITableViewController
,其UIRefreshControl
是远远比我增加了我的UITableView
一个更加不同。
单独的UITableView
的UIRefreshControl
在拖动时比较慢,我通常必须拖动FARTHER才能让它开始刷新。
在我的其他屏幕上,我的UITableViewController
的UIRefreshControl
在拖动时速度更快,而且我不必拖动到目前为止就可以开始刷新。
我喜欢UITableViewController
的UIRefreshControl
的平滑行为,让我怎么得到我的UIRefreshControl
我UITableView
的行为更像是属于UITableViewController
默认的?
这可能吗?或者正在使用UIContainerView
并使用UITableViewController
我唯一的选择?
感谢您的链接!我对使用hacky的'UITableViewController'实例解决方案有点犹豫,但它工作完美! – Rafi