Objective c 获取完整页面WebView的框架减去UINavigationBar

Objective c 获取完整页面WebView的框架减去UINavigationBar,objective-c,ios,uiview,Objective C,Ios,Uiview,如何获得除去导航栏的完整网页视图的正确框架 我试过这个 CGRect screenFrame = [[UIScreen mainScreen]bounds]; webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, screenFrame.size.width, screenFrame.size.height-self.navigationController.navigationBar.bounds.size.height)];

如何获得除去导航栏的完整网页视图的正确框架

我试过这个

CGRect screenFrame = [[UIScreen mainScreen]bounds];
webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, screenFrame.size.width, screenFrame.size.height-self.navigationController.navigationBar.bounds.size.height)];

但当我向下滚动时,滚动条被切断。看起来webView的框架高度仍然太大。

假设您的导航栏是从导航控制器添加的,您可以使用:

self.view.bounds.size.height
但是,如果您自己在IB或其他文件中添加了它,请使用:

self.view.bounds.size.height - myNavBar.bounds.size.height

webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];