tags:

views:

11

answers:

0

As I'm not going to use XIB / nibs, I need to create all view controllers programmatically. However, I figured out that this really sucks hard. UIViewController seems to position and resize it's view in a really strange, unpredictable way.

Example: I created a new project with this setup:

1) A RootViewController:UIViewController, whoose view is added as subview to the window.

2) Inside RootViewController, a UITabBarController which is added as subview.

3) RootViewController's view has an orange background color

4) UITabBarController's view has an green background color

5) The view of UITabBarController is shifted down by 20 units (height of status bar), but it should be at 0/0. Now there's a gap of 20 units where the orange background shines through. None of any autoresizingMasks solved this.

What's the "magic" behind all this?