这真让我抓狂!我有一个UICollectionViewController,如下所示:
class PhrasesCompactCollectionViewController: UICollectionViewController
Run Code Online (Sandbox Code Playgroud)
正在调用numberOfSections和cellForItemAt,但从不调用sizeForItemAtIndexPath.我在其他地方使用相同的确切代码,它正确触发.我正在使用Xcode 8 Beta 6.
func collectionView(collectionView: UICollectionView,
                        layout collectionViewLayout: UICollectionViewLayout,
                        sizeForItemAtIndexPath indexPath:  NSIndexPath) -> CGSize {
        return CGSize(width: 120, height:120) 
    }
Run Code Online (Sandbox Code Playgroud) ios ×1