headerReferenceSize
カスタムでを使用しようとしていますUICollectionViewFlowLayout
。
collectionView:layout:referenceSizeForHeaderInSection:
collectionViewデリゲートにメソッドを設定しました:
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSize(width: UIScreen.mainScreen().bounds.width, height: round(250*(UIScreen.mainScreen().bounds.width/414)))
}
これは、ビューが読み込まれるときに 1 回呼び出されます。ただし、カスタム UICollectionViewFlowLayout は、デリゲートからではなく、ストーリーボードで設定されたサイズを取得し続けます。どうしてこれなの?