I am adding a UIViewController's view to another UIViewController's views (using the new UIViewController Containment APIs). After adding the vc's view as another's subivew, there's a weird 20px margin from the top.
I logged the view and it's from origin was 0,0. However, I when I log the view's superview, it's:
<UIViewControllerWrapperView: 0x6c5e2c0; frame = (0 20; 703 748); autoresize = RM+BM; layer = <CALayer: 0x6c54190>>
I can obviously change it's frame to 0,0. But i am wondering what's the right way to do this? Why is the vc's view's superview's frame 0,20? Should I modify this or is there a better way to go around this weird margin?
Thanks
To fix this problem just check the box "Wants Full Screen"
on the storyboard.
The problem appears because the ParentViewController is showing the navigation bar.
As apple documentation said :
If your app displays the status bar, the view shrinks so that it does not underlap the status bar. After all, if the status bar is opaque, there is no way to see or interact with the content lying underneath it. However, if your app displays a translucent status bar, you can set the value of your view controller’s wantsFullScreenLayout property to YES to allow your view to be displayed full screen. The status bar is drawn over the top of the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With