views:

134

answers:

1

I don't use IB much for creating my views, so I usually do everything programatically. I'm bascially pushing a viewController to a navigation controller and it seems the top part of the viewController is under the navigation bar. I'm trying to make the view fit correctly.

Here is my code:

navigationController = [[UINavigationController alloc] initWithNibName:nil
                                                                bundle:nil];
[window addSubview:navigationController.view];

viewController = [[UIViewController alloc] init];

//this code was just added to try and make it fit. It doesn't change anything
viewController.view.frame = [UIScreen mainScreen].applicationFrame;

[navigationController pushViewController:viewController animated:NO];
A: 

I would be careful using the init method with view controllers - instead look at initWithNibName:bundle:.

Tim
Changed it didn't fix it. I've never has such problems with a navigation controller before.
TheGambler
changed it to initWithNibName:nil bundle:nil
TheGambler
Still not working
TheGambler
You need to pass it the name of the nib that you created in IB (`nil` is OK for the bundle name though).
Tim