![](/img/trans.png)
[英]How do I add a UICollectionView inside a UICollectionViewCell?
[英]How do I add a UIActivityIndicatorView to footer of UICollectionView?
如何在swift中向UICollectionView
页脚添加UIActivityIndicatorView
? 对于UITableView
,它只是self.tableView.tableFootView = self.myActivityIndicatorView
。 这可能吗? 如果是这样,怎么样?
在该视图中创建视图类并添加活动指示
使用以下命令将此类注册为页脚视图类:
registerClass(myFooterViewClass, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "myFooterView")
在集合视图布局或实现上设置headerReferenceSize
collectionView:layout:referenceSizeForHeaderInSection: in your delegate.
从dataSource中的以下方法返回页脚视图:
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.