swift - 如何将 UIActivityIndi​​catorView 添加到 UICollectionView 的页脚?

标签 swift uicollectionview footer uiactivityindicatorview

如何在 swift 中将 UIActivityIndi​​catorView 添加到 UICollectionView 的页脚?对于 UITableView,它只是 self.tableView.tableFootView = self.myActivityIndi​​catorView。这可能吗?如果是,怎么办?

最佳答案

创建 View 类并在该 View 中添加事件指示

使用以下方法将此类注册为页脚 View 类:

registerClass(myFooterViewClass, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "myFooterView")

在您的 Collection View 布局上设置 headerReferenceSize 或实现

collectionView:layout:referenceSizeForHeaderInSection: in your delegate.

从数据源中的以下方法返回页脚 View :

func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let view = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionFooter, withReuseIdentifier: "myFooterView", forIndexPath: indexPath)
// configure footer view
return view
}

关于swift - 如何将 UIActivityIndi​​catorView 添加到 UICollectionView 的页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37059703/

相关文章:

ios - 使用 Swift 与需要 block 作为参数的 Objective C 方法进行交互

ios - Swift 3 - 如何让我的计时器在后台计数?

css - 为什么页脚不是一直从左到右?

ios - 使用swift读取iOS系统日志

ios - 从侧面菜单中选择菜单项时,TabBar 会消失吗?

iOS:不为 UICollectionView 中包含的 UITableView 调用 cellFowRow

iphone - 为什么 indexPathForItemAtPoint 总是返回 nil

ios - UICollectionViewCell 与异步图像重用加载错误图像

html - ASP.net 主页中的 Flexbox 粘性页脚

css - 在底部保持可变高度的页脚