我的 UIWebView 有问题。当视图加载时,它可以很好地加载任何方向,完美地填充整个页面等。
但是,如果我以纵向加载它,然后旋转设备,webview 不会一直填充到右侧,我终生无法弄清楚原因。
这是我的观点确实加载方法
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib
if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait){
self.measurementsWebView.frame = CGRectMake(0, 0, 320, 367);
}else if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight){
self.measurementsWebView.frame = CGRectMake(0, 0, 480, 218);
}
NSString *path = [[NSBundle mainBundle] pathForResource:@"measurements" ofType:@"png"];
[measurementsWebView loadHTMLString:[NSString stringWithFormat:@"<html><body><img src=\"file://%@\"></body></html>",path] baseURL:nil];
measurementsWebView.scalesPageToFit = YES;
}
如果我查看界面生成器,我试图找到允许我设置扩展宽度或您所称的面板的面板,但我能看到的就是这个。
任何帮助将不胜感激