【发布时间】:2018-10-16 12:35:13
【问题描述】:
我只需要一个高度为 50 且背景颜色为黑色的页脚。而已。暂时忘记下面的实现,然后告诉我你将如何实现它。
我正在使用以下内容:
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let view = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "FooterView", for: indexPath as IndexPath)
// configure footer view
return view
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize
{
return CGSize(width: 375, height: 100)
}
但是,没有页脚附加到集合视图。我无法理解为什么这不起作用以及我应该如何纠正这个问题。请帮我纠正这个问题。
【问题讨论】:
-
您能附上尺寸检查器的屏幕截图,以及页脚视图和页眉视图的高度吗?
-
你设置
delegate的UICollectionView了吗? -
@hardikparmar,请检查编辑。 @dani,是的
-
这是自定义页脚吗?意思是,您是否为
UICollectionReusableView使用自定义类? -
@Dani,没有。请帮我放置一个高度为 50 且背景颜色为黑色的空页脚。就是这样。谢谢。
标签: ios swift xcode uicollectionview uicollectionviewcell