![](/img/trans.png)
[英]iOS - NavigationBar Title overlapped by previous viewController
[英]ios, navigationbar is overlapped with its content view
我正在呈現一個如下所示的viewcontroller,並且所呈現的view controller的內容與它自己的導航欄重疊。
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調整到整個屏幕-導航欄-狀態欄。 (當我pushedViewController
時效果很好)
self.webview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
[self.view addSubview:self.webview];
self.webview.frame = self.webview.superview.bounds;
請在viewDidLoad
方法中添加以下行:
self.navigationController.navigationBar.translucent = YES;
self.edgesForExtendedLayout = UIRectEdgeNone;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.