I'm trying to use the headerReferenceSize
in my custom UICollectionViewFlowLayout
.
I have set the collectionView:layout:referenceSizeForHeaderInSection:
method in the collectionView delegate:
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)))
}
This gets called once when the view loads. However, the custom UICollectionViewFlowLayout keeps retrieving the size set in the storyboard, and not from my delegate. Why is this?