如何在iOS中的CollectionView的页脚中添加加载指示器 [英] How to add loading Indicator in Footer of CollectionView in iOS

查看:100
本文介绍了如何在iOS中的CollectionView的页脚中添加加载指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为下一页加载数据时,如何在集合视图的页脚中添加加载指标..?

How can I add loading Indicator in the Footer of collection view when data is loaded for next page..?

我想在收集视图的页脚中加载指标与上图相同。
但是我无法做到这一点。

I want to loading indicator in Footer of Collection view as same as above image. But I can not able to do this.

那么有可能吗?否则,我必须使用tableview创建这种类型的列表视图。因为我们可以轻松地将这些内容管理到tableview中。

So Is it possible or not..? Otherwise, I have to create this type of list view using tableview. Because We can easily manage this things into tableview.

任何帮助都将不胜感激。

Any help would be appreciated.

推荐答案

我在 CCBottomRefreshControl 的帮助下找到了一个非常简单的解决方案
你需要就像简单的UIRefreshController一样对待它

I found one very easy solution with help of CCBottomRefreshControl You need to just treat it like simple UIRefreshController

let bottomRefreshController = UIRefreshControl()
bottomRefreshController.triggerVerticalOffset = 50
bottomRefreshController.addTarget(self, action: #selector(ViewController.refreshBottom), forControlEvents: .ValueChanged)

collectionView.bottomRefreshControl = bottomRefreshController

func refreshBottom() {
     //api call for loading more data
     loadMoreData() 
}

和您认为应该停止加载的地方

and where you think you should stop loader simply

collectionView.bottomRefreshControl.endRefreshing()

这篇关于如何在iOS中的CollectionView的页脚中添加加载指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆