Hur*_*rkS 5 iphone uiwebview uiinterfaceorientation ios
我的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;
}
Run Code Online (Sandbox Code Playgroud)
如果我查看界面构建器,我试图找到允许我设置扩展宽度的面板或者你所谓的它,但我只能看到这一点.

任何帮助将不胜感激
在界面生成器中,下拉菜单中显示“布局矩形”,单击它并选择“框架矩形”。
或者,您可以重写willAnimateRotationToInterfaceOrientation:视图控制器中的方法并手动设置坐标/大小,就像在viewDidLoad.
| 归档时间: |
|
| 查看次数: |
5328 次 |
| 最近记录: |