相关疑难解决方法(0)

从未调用CollectionView sizeForItemAtIndexPath

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

76
推荐指数
7
解决办法
4万
查看次数

标签 统计

ios ×1