我有一個iPad應用程序,應該顯示移動谷歌UIWebView。它的寬度和iPhone一樣是320px,我已經設置了用戶代理,以便加載移動Google。但是該網站比UIWebView更寬,儘管該網站針對手機屏幕進行了優化。 這是我創建Web視圖代碼:iPad的UIWebView與iPhone網站
NSDictionary *userAgentDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:userAgentDictionary];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 44, 320, 480)];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]];
[webView loadRequest:request];
[self addSubview:webView];
這是怎麼看起來像此刻:
我能做些什麼,使之適合?它應該與其他非移動頁面一起工作。
然後WebView被調整大小,但我希望webview像iPhone一樣是320x480像素。但是,內容不適合在iPhone上使用。 – icant