Adding a section header to the collection view
A collection view can be configured with a section header and a section footer. Both of them are instances of the UICollectionReusableView
class. You’ll enable the section header for the collection view in the Explore screen, so you’ll have a place to put the LOCATION button. Follow these steps:
- Click the
Main
storyboard file in the Project navigator and click the Collection View in the document outline. Click the Attributes inspector button. Under Collection View, tick the checkbox for Section Header:Figure 11.29: Attributes inspector with Section Header checkbox ticked
This enables the section header for the collection view.
- Note that Collection Reusable View appears in the document outline. This represents the collection view section header. Click on Collection Reusable View in the document outline. In the Attributes inspector under Collection Reusable View, set Identifier...