【发布时间】:2019-02-12 01:36:07
【问题描述】:
我想在 collectionview 中实现 pegination,并在最后一项下方刷新一个视图,我们如何在 swift 4 中实现这一点?
【问题讨论】:
-
这可能对您有所帮助。 link
-
到目前为止你做了什么尝试,遇到了什么问题?
-
感谢您的建议,我已经更改了标签。
标签: ios
我想在 collectionview 中实现 pegination,并在最后一项下方刷新一个视图,我们如何在 swift 4 中实现这一点?
【问题讨论】:
标签: ios
我已将 2 个公共变量声明为:
var page_number = 1
var total_count = 0
并编辑 willDisplay 委托方法为:
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath)
{
if(indexPath.item == (arrayProperties.count - 1) && arrayProperties.count < total_count )
{
page_number = page_number+1
// Call api with updated page_number
callApi(pageNumber: page_number)
}
}
【讨论】: