【发布时间】:2015-05-25 11:27:44
【问题描述】:
在 tableView 中,当我从顶部下拉时,它正在获取数据。但是如果我想在tableView中从底部拉出数据,我该如何实现,请建议我
【问题讨论】:
标签: ios
在 tableView 中,当我从顶部下拉时,它正在获取数据。但是如果我想在tableView中从底部拉出数据,我该如何实现,请建议我
【问题讨论】:
标签: ios
我也遇到了这种情况,最后我找到了一些答案,比如UIRefreshControl at the bottom of the UITableView iOS6?,因此在页脚视图中实现了我们的UIActivityIndicatorView。因此它现在工作正常。
// call this method in `viewDidLoad` and connect the tableview delegates.
-(void)initializeRefreshControl
{
indicatorFooter = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableVeiwMarkets.frame), 44)];
[indicatorFooter setColor:[UIColor blackColor]];
[indicatorFooter startAnimating];
[self.tableVeiwMarkets setTableFooterView:indicatorFooter];
}
-(void)refreshTableVeiwList
{
// your refresh code goes here
}
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
if (scrollView.contentOffset.y + scrollView.frame.size.height == scrollView.contentSize.height)
{
[self refreshTableVeiwList];
}
}
【讨论】:
请在表格视图底部找到以下控件以显示下拉刷新
【讨论】:
您可以为此使用MNMBottomPullToRefresh。它易于使用
1) 将整个 MNMBottomPullToRefresh 文件夹复制到您的项目中
2) 在你的 UIViewController 类中,创建一个 MNMBottomPullToRefreshManager 来链接 UITableView 和 MNMPullToRefreshView。在 viewDidLoad 中使用这样的句子:
pullToRefreshManager_ = [[MNMBottomPullToRefreshManager alloc] initWithPullToRefreshViewHeight:60.0f tableView:table withClient:self];
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[pullToRefreshManager_ tableViewScrolled];
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate: (BOOL)decelerate
{
[pullToRefreshManager_ tableViewReleased];
}
- (void)bottomPullToRefreshTriggered:(MNMBottomPullToRefreshManager *)manager
{
//method to get more data
// [self CallWebServiceToLoadMorePAYMENTS];
}
}
重载tableview调用后
[pullToRefreshManager_ tableViewReloadFinished];
【讨论】:
我刚刚推出了自己的“上拉刷新”Cocoapod: https://cocoapods.org/pods/LottiesBottom 它基于airbnb的Lottie。你可以插入任何你想要的 Lottie 动画。
【讨论】:
我已经制作了这个 Swift 库来添加拉动刷新到UITableview 的底部。
https://github.com/marwendoukh/PullUpToRefresh-iOS
希望对你有所帮助。
【讨论】: