我在普通视图控制器中使用集合视图,使用集合视图委托和数据源。我正在使用sizeForItemAtIndexPath,但它不调整单元格的大小。
let screenSize: CGRect = UIScreen.main.bounds
func collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
{
return CGSize(width: screenSize.width / 3, height: screenSize.width / 3)
}
集合视图使用autoLayout正确地分配约束。
在iPhone5中的样子
它应该是什么样子
我知道estimatedItemSize是使用的,但我不能使用它,因为这不是UICollectionViewController。谢谢你的建议?
发布于 2016-10-09 14:03:01
确保:
UICollectionViewDelegateFlowLayout
。minimumInteritemSpacingForSectionAt
来更改它。我希望这回答了你的问题。
https://stackoverflow.com/questions/39944207
复制相似问题