【问题标题】:how to show pull up to refresh control in the bottom of tableview?如何在表格视图底部显示上拉刷新控件?
【发布时间】:2015-05-25 11:27:44
【问题描述】:

在 tableView 中,当我从顶部下拉时,它正在获取数据。但是如果我想在tableView中从底部拉出数据,我该如何实现,请建议我

【问题讨论】:

标签: ios


【解决方案1】:

我也遇到了这种情况,最后我找到了一些答案,比如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];
        }
    }

【讨论】:

  • 如果我想用 indicatorFooter 设置文本,我该如何设置文本|?
  • 您可以将标签添加到该页脚视图。因此,您可以创建自定义指标视图。
  • 天才解决方案。我怎么没想到?哈哈哈。
【解决方案2】:

请在表格视图底部找到以下控件以显示下拉刷新

网址:https://github.com/vlasov/CCBottomRefreshControl

【讨论】:

  • 这个只刷新一次。它没有第二次调用刷新函数拉刷新。
  • 好的,我自己找到了答案...我们需要调用 [refreshcontroll endRefreshing];加载完成后
  • CCBottomPullToRefresh 在我的 Swift 项目中运行,但未显示活动指示器。你能帮忙吗
  • 感谢@RamkrishnaSharma 的帮助
  • 我的标签栏高度是个问题,所以指示器隐藏在它后面。现在可以正常使用了,谢谢
【解决方案3】:

您可以为此使用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];

【讨论】:

    【解决方案4】:

    我刚刚推出了自己的“上拉刷新”Cocoapod: https://cocoapods.org/pods/LottiesBottom 它基于airbnb的Lottie。你可以插入任何你想要的 Lottie 动画。

    【讨论】:

      【解决方案5】:

      我已经制作了这个 Swift 库来添加拉动刷新到UITableview 的底部。

      https://github.com/marwendoukh/PullUpToRefresh-iOS

      希望对你有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-02-11
        • 1970-01-01
        • 1970-01-01
        • 2015-01-27
        • 2011-06-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多