我遇到了与我的UIWebView有关的问题。当视图加载它在任何方向加载它的罚款,完全填充整个页面等。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;
}
如果我看在界面生成器,我试图找到,让我来设置扩大宽度,或者你叫它什么都面板,但我可以看到这是。
任何帮助,将不胜感激
奇怪的是,即使我这样做,它不改变菜单的外观......我想也许我需要重新安装xcode。我会尝试shouldAutototateToInterfaceOrientation现在..但是,这将改变UIView帧的大小,以适应水平视图。 – HurkNburkS 2012-07-09 01:00:39
对不起,我的意思是写'willAnimateRotationToInterfaceOrientation:'方法。与您在'viewDidLoad'方法中检查方向的方式类似,您可以在此执行同样的操作并调整视图的框架。 – sooper 2012-07-09 01:21:38
对于你的界面生成器的问题,我建议你阅读这篇文章[这里](http://stackoverflow.com/questions/9370072/xcode-4-3-not-presenting-autoresizing-panel-in-size-inspector ) – sooper 2012-07-09 01:27:37