objective c - iOS - `UIViews` behind `UICollectionViewCell`disappear -


i have gallery using uicollectionview prepared using main.storyboard. have few uiviews , uibutton placed between uicollectionview , uicollectionviewcell. when test app, of uiviews , uibuttons disappear. enter image description here

but have catalog scene prepared using same way , there. seems issue?

i wouldn't mess uicollectionview's view hierarchy way. since handles own list of subviews, yours may obstructed. suggest 1 of 2 methods:

  1. set uicollectionview background [uicolor clearcolor], , put own views behind uicollectionview, in hierarchy similar this:

    • uiview
      • your custom views
      • uicollectionview
  2. use uicollectionview's decoration views. can read more them here, in "including decoration views in custom layouts" section.

    decoration views visual adornments enhance appearance of collection view layouts. unlike cells , supplementary views, decoration views provide visual content , independent of data source. can use them provide custom backgrounds, fill in spaces around cells, or obscure cells if want. decoration views defined , managed solely layout object , not interact collection view’s data source object.