How can I enable/disable section headers in UICollectionView programmatically?
You can either use the collectionView:layout:referenceSizeForHeaderInSection: method of the UICollectionViewDelegateFlowLayout and return CGSizeMake(0,0) or set accordingly the headerReferenceSize of UICollectionViewFlowLayout. Edit: headerReferenceSize is actually the property that storyboard uses to show/hide the headers. I’ve added the relevant lines from the Storyboard file With section checkbox on: <collectionViewFlowLayout key=”collectionViewLayout” minimumLineSpacing=”10″ minimumInteritemSpacing=”10″ id=”xAt-Uo-bMl”> <size key=”headerReferenceSize” width=”50″ height=”50″/></collectionViewFlowLayout> …