0
如果我希望一切都像以前一樣工作,我必須從collectionView:layout:referenceSizeForFooterInSection
返回什麼值。collectionView的默認值:layout:referenceSizeForFooterInSection
背景:我想禁用某些部分的頁腳,所以我回來CGSize.zero
那些,但我不知道該怎麼返回應顯示
如果我希望一切都像以前一樣工作,我必須從collectionView:layout:referenceSizeForFooterInSection
返回什麼值。collectionView的默認值:layout:referenceSizeForFooterInSection
背景:我想禁用某些部分的頁腳,所以我回來CGSize.zero
那些,但我不知道該怎麼返回應顯示
從功能的文檔
的那些如果您未實現此方法,流佈局將使用其footerReferenceSize屬性中的值 來設置頁腳的大小。
所以,簡單地返回footerReferenceSize
從你流佈局,像這樣
if let collectionViewFlowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
return collectionViewFlowLayout.footerReferenceSize
}
功能具有collectionViewLayout作爲參數,這樣你就可以直接做'collectionViewLayout作爲? UICollectionViewFlowLayout' – Daniel
是的,我忘了這個函數接收佈局作爲參數 –