我遇到了與我的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