iosinterface-builderuiview-hierarchy

iOS: How to cover status bar with container view


I have following view hierarchy in my main view controller:

Main view -> Container view -> Page view controller in container view -> Item view controller for every page

I need to make item view controller to place his view above status bar of main view controller. I've added constraint from container view's top to main view's top (not to top layout guide):

top constraint

But item view controller places his view (green one on picture) under status bar anyway:

green view

Can I do something to get needed behaviour? I need the status bar to be covered by view from item view controller, not by any view from other view controllers.

Thanks.


Solution

  • In storyboard set the top constraint to view not to top safeAreas / topLayoutGuide