1
我在使用集合视图委托和数据源的普通视图控制器内使用集合视图。我正在使用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为集合视图分配约束。
我知道estimatedItemSize使用,但我无法使用它,因为这不是一个UICollectionViewController。感谢您的任何建议?