这真让我抓狂!我有一个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)
}