Alex Rivera | Logout

UIViewController's view has weird 20px y margin

Asked 2012-06-28T20:28:51.873
11

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

Edit
Report

1 Answer

0

Even if you tried setting the Status Bar pull down menu to "none", check the size properties of your view, too. Make sure it's not still got some hard-coded height value of 460, or y origin of 20 (in Xcode's graphical designer). And if you want this view to fill its entire parent view, then make sure the autoresizing mask is set in properties to be pinned to all sides (top, left, bottom, right) and probably set to stretch, too.

Just looking at your debug output, it looks like maybe the autoresizing properties are only set to UIViewAutoresizingFlexibleBottomMargin and UIViewAutoresizingFlexibleRightMargin.

Finally, the containing view probably needs to have its Autoresize Subviews checkbox checked.

answered 2012-06-28T21:17:05.673

Your Answer