我正在展示如下所示的viewcontroller,并且呈现的视图控制器的内容与其自己的导航栏重叠。
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:^{
}];
我可以通过调整contentView的帧原点/大小来修复它,但有更简单的方法吗?
self.webview是contentview,我曾经使用以下代码使webview适合整个屏幕 - navigationbar - statusbar。 (当我只是pushedViewController
时)效果很好
self.webview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
[self.view addSubview:self.webview];
self.webview.frame = self.webview.superview.bounds;
答案 0 :(得分:0)
请在viewDidLoad
方法中添加以下内容:
self.navigationController.navigationBar.translucent = YES;
self.edgesForExtendedLayout = UIRectEdgeNone;