これは私を夢中にしています!以下に示すように、私はUICollectionViewControllerを持っている:CollectionView sizeForItemAtIndexPathはまだ呼び出されていません
class PhrasesCompactCollectionViewController: UICollectionViewController
numberOfSectionsとcellForItemAtが呼び出されているが、sizeForItemAtIndexPathが呼び出されることはありません。私は他のどこかで同じ正確なコードを使用しており、正しく起動します。私はあなたがあなたのクラス宣言におけるプロトコルUICollectionViewDelegateFlowLayout
を実装することを指定する必要がXcodeの8のベータ版6
func collectionView(collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: 120, height:120)
}
ありがとうございます! Xcode 8 Beta 6の異なる署名でした。ありがとう! –
この回答は受け入れる必要があります。 –
偉大な答え、ありがとう! – Rados