2

I have two different view that I need to implement in UICollectionView. My question is how can I add two UICollectionReusableView to UICollectionView using storyboard?

For example I can add it as source code:

[self.collectionView registerClass:[HeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView"];

and also have another header in storyboard,

but how can I add two UICollectionReusableView to storyboard and config them.

Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277

1 Answers1

1

Drag them into the Document Outline:

enter image description here

pbasdf
  • 21,386
  • 4
  • 43
  • 75
  • 1
    I just tried to add it like in your example but I can put it as new one it just replace it. Please check the video https://www.youtube.com/watch?v=-fhLnxB--pU – Matrosov Oleksandr Oct 06 '14 at 09:54
  • and in your example you are using seems header and footer view but I need two headers views. I implemented it programatically, but using storyboard can't achieve this. – Matrosov Oleksandr Oct 06 '14 at 09:56
  • Yes, I see now that it is adding them as separate header and footer views. And, like you, I can't add a third. – pbasdf Oct 06 '14 at 10:17
  • The best I can suggest is that you add them as children of the scene, rather than the CollectionView. You cannot then see them in the layout, but you can swap them to and from the collection view in order to edit their contents and layout. I think (but haven't tested) that you will still be able to select the different versions in code provided you assign them different reuse IDs. – pbasdf Oct 06 '14 at 10:33