如何在 swift 中将 UIActivityIndicatorView
添加到 UICollectionView
的页脚?对于 UITableView
,它只是 self.tableView.tableFootView = self.myActivityIndicatorView
。这可能吗?如果是,怎么办?
最佳答案
创建 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 - 如何将 UIActivityIndicatorView 添加到 UICollectionView 的页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37059703/