2013-06-08 4 views
0

스토리 보드를 사용하고 있습니다. 스토리 보드의 화면 크기에 따라 webview의 크기를 조정할 수 없습니다. iphone 앱의 화면 해상도에 따라 webview의 크기를 조정하는 방법은 무엇입니까?

iphone5 and iphone4 resolutions

나는 헤더가 모두 해결을 위해 동일한 크기 여야하지만 화면 해상도에 따라 웹보기의 높이를 변경하고 싶습니다.

ios5 이상에서 내 앱을 배포하려고하기 때문에 Autolayout을 사용할 수 없습니다.

도와주세요.

답변

2

당신이 당신의 `webview

CGRect webFrame = [[UIScreen mainScreen] applicationFrame]; 
webFrame.origin.y -= 20.0; // statusbar 20 px cut from y of frame 
webView = [[UIWebView alloc] initWithFrame:webFrame]; 
webView.scalesPageToFit = YES; 
webView.autoresizesSubviews = YES; 
webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); 
[webView setBackgroundColor:[UIColor clearColor]]; 
을 ALLOC 어디 우는 소리 같은 UIScreen에 따라 Webview 프레임을 설정할 수 있습니다
0

.m 파일에 viewDidLoad 아래에이 코드를 추가하십시오.

webview.frame = CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.he‌​ight); 

웹보기의 참조 콘센트를 webView에 추가 한 다음 WebView 높이를보기 높이로 설정해야합니다.

설명 : 4 인치 시뮬레이터에 배치하면 WebView가보기의 크기로 변경되므로보기가 더 길어집니다.

관련 문제