2013-01-04 34 views
0

如何獲取整頁webview的正確框架減去導航欄。獲取整頁WebView的框架減去UINavigationBar

我想這

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的框架高度仍然太大。從導航控制器加入

回答

0

假設你的導航欄,您可以使用:

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)];