Resize UIWebView in detail view of split view controller
I have a UIWebView in the detail view of my split view controller application. Everything works fine, but the width of the web view does not change when the iPad is rotated. How can I ensur开发者_运维百科e that the web view always occupies all available space in the detail view outside of the UIToolbar that lives at the top?
set the uiwebview frame property to match that of the parent view, adding some padding as needed.
WebView = [[UIWebView alloc] initWithFrame:CGRectMake(5, 5, self.view.frame.size.width -5, self.view.frame.size.height -5)];
use the "autoresize" and set flexible width and/or height. that should do the trick
WebView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
精彩评论