这让我疯狂!我有一个如下所示的UICollectionViewController
:
class PhrasesCompactCollectionViewController: UICollectionViewController
numberOfSections
和 cellForItemAt
被调用了,但是sizeForItemAtIndexPath
从未被调用。我在别的地方使用完全相同的代码,它可以正确触发。我使用的是 Xcode 8 Beta 6。
func collectionView(collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: 120, height:120)
}