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

查看:18
本文介绍了如何在 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.

任何帮助将不胜感激.

推荐答案

我在 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天全站免登陆