I'm presenting a viewcontroller like below, and the presented view controller's content overlaps the navigationbar of its own.
MyViewController *myViewController = [[MyViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:myViewController];
//now present this navigation controller modally
[self presentViewController:navigationController
animated:YES
completion:^{
}];
I can probably fix it by adjusting the contentView's frame origin/size but, is there an easier way?
self.webview is the contentview, and I used to have the following code to fit the webview to the entire screen - navigationbar - statusbar. (which worked well when I just pushedViewController
)
self.webview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
[self.view addSubview:self.webview];
self.webview.frame = self.webview.superview.bounds;
Please add following lines in your viewDidLoad
method:
self.navigationController.navigationBar.translucent = YES;
self.edgesForExtendedLayout = UIRectEdgeNone;