【发布时间】:2013-12-30 10:36:18
【问题描述】:
有没有办法在 UITableView 下添加 UIRefreshControl?我创建了一个preview 我想要实现的目标。
【问题讨论】:
-
这里已经有一篇不错的帖子stackoverflow.com/questions/14942460/…
标签: ios uitableview uirefreshcontrol
有没有办法在 UITableView 下添加 UIRefreshControl?我创建了一个preview 我想要实现的目标。
【问题讨论】:
标签: ios uitableview uirefreshcontrol
这些不会提供 UIRefresh 控件,但您可以将它们添加到屏幕底部
在你的标题下面声明
UIActivityIndicatorView *spinner;
在您的实现中在 ViewDidLoad 中初始化相同的内容
spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
[spinner stopAnimating];
spinner.hidesWhenStopped = NO;
spinner.frame = CGRectMake(0, 0, 320, 44);
self.tableviewName.tableFooterView = spinner;
添加这些会在tableview Scrolled时调用
- (void)scrollViewDidEndDragging:(UIScrollView *)aScrollView
willDecelerate:(BOOL)decelerate{
CGPoint offset = aScrollView.contentOffset;
CGRect bounds = aScrollView.bounds;
CGSize size = aScrollView.contentSize;
UIEdgeInsets inset = aScrollView.contentInset;
float y = offset.y + bounds.size.height - inset.bottom;
float h = size.height;
float reload_distance = 50;
if(y > h + reload_distance) {
NSLog(@"load more data");
[spinner startAnimating];
}
}
希望对你有所帮助!
【讨论】: