In my swift
app I'm using UICollectionViewController
in which I'm displaying photos one next to each other:
I also added on top of the collection view a header, I did it through story board by checking this option:
So now I see that header in my story board, I can even put there some labels:
but how can I display there anything? I tried attaching IBOutlet from this label to the class that is a main class of that view, but that brings me error saying that outlets from Collection reusable view
cannot be attached directly to UICollectionViewcontroller
. What can I do in this situation?
To accomplish this you need to subclass UICollectionViewController and assign this class as the of your Header and Footer. Then in that class you can create the Outlet connection of the views you assign in the storyboard.
Subclass the UICollectionReusableView:
Assign your subclass to the UICollectionViewController header:
Drag elements to the header in the storyboard then create the IBOutlet connection.