6

I have a UICollectionView with a custom layout. It shows items in grid (2 columns) and it has multiple sections. It works perfect.

Now, I want to add a UIView at the top of the UICollectionView.

NOTE: This is not a view per section. This is a View for the entire UICollectionView.

What is the best approach to achieve this? Keep in mind that my UICollectionView already shows a custom UIView for each section.

Actually, what I want is something like we can do with uitableview tableHeaderView.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
Paulo Venturi
  • 501
  • 5
  • 9
  • http://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/Reference/Reference.html#//apple_ref/occ/instp/UICollectionView/backgroundView is this what you are looking for? – Sascha Aug 07 '13 at 16:28
  • Is that view data-driven or not ? In the second case, you may want to use a decorationView – Nerkatel Aug 07 '13 at 16:29
  • Actually, what I want is something like we can do with uitableview tableHeaderView. – Paulo Venturi Aug 07 '13 at 16:35
  • I found a workaround to this problem [here](http://stackoverflow.com/a/18015870/2373811) Thanks everyone! – Paulo Venturi Aug 07 '13 at 16:51
  • possible duplicate of [How to add HeaderView in UICollectionView like UITableView's tableHeaderView](http://stackoverflow.com/questions/13522075/how-to-add-headerview-in-uicollectionview-like-uitableviews-tableheaderview) – Marcus Adams Aug 07 '13 at 17:11

0 Answers0