簡體   English   中英

如何在UICollectionView的頁腳中添加UIActivityIndi​​catorView?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM