Reputation: 1306
Whe I create a new UIViewController and try to put inside a NavigationController in the usual way (drag-drop in the xib and create the outlet), I show the Navigationcontroller with:
[self.view addSubview:navigationController.view]
The result is a Navigation Bar with a little band in the upper part (seems displaced down), (i can't post the image now but is like 20px empty space)
I tried to put the navigation controller on the top window:
[[[UIApplication sharedApplication] keyWindow] addSubview:navigationController.view];
And it worked, but I'm unable to come back the initial screen whe I execute:
[navigationController.view removeFromSuperview]
or
[self dissmissModalViewControllerAnimated:YES];
It is possible to solve this?
Upvotes: 1
Views: 1610
Reputation: 3733
UINavigationController* nav=[[UINavigationController alloc]init];
nav.navigationBar.frame=CGRectMake(0, 0, 320, 44);
NSLog(@"desc=%@",[nav.navigationBar description]);
[self.view addSubview:nav.navigationBar];
Try with above code. it will hide unnecessary space. Thanks
Upvotes: 1
Reputation: 7340
20 pixels sounds like the status bar. Make sure in your nib that the status bar option for the view is set to None. Hope that Helps!
Upvotes: 0