8

I would like to set a background color for the entire section in a UICollectionView. I want the area between "Header" and "Footer" to have a different background color than the background color of the UICollectionView itself.

enter image description here

I made this drawing to clarify what I want. I want something like the green background color inside the red rectangle. Is there a way to set a UIView behind the cells so I can color this view?

Tulon
  • 4,011
  • 6
  • 36
  • 56
Argent
  • 390
  • 1
  • 3
  • 11

1 Answers1

0

I haven't tried this out yet, but it look to me that you need to use decoration views if want a background behind you cells (like the shelf in the Books app). I think you should be able to have different views for each section, and set them up using the delegate method, layoutAttributesForDecorationViewOfKind:atIndexPath:.

Thanks to @rdelmar in How to change background color of a whole section in UICollectionView?

Community
  • 1
  • 1
Pancho
  • 4,099
  • 1
  • 21
  • 32