我的 UIWebView 遇到问题。当视图加载时,它会以任一方向加载,完美填充整个页面等。
然而,如果我以纵向方式加载它,然后旋转设备,网络视图不会一直填充到右侧,我一生都无法弄清楚为什么。
这是我的看法确实加载方法
- (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;
}
如果我查看界面生成器,我试图找到允许我设置扩展宽度或您所说的任何内容的面板,但我只能看到这个。
任何帮助将不胜感激
您还可以将自动调整大小蒙版设置为:
measurementsWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
如果屏幕上没有其他元素(我认为,根据调整大小时使用的值,您没有其他元素),这将调整 webView 的大小measurementsWebView
)。或者,直接从笔尖开始,如下图所示:
可以通过单击框中的红色条来设置蒙版自动调整大小向左下角。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)