2012-03-14 2 views
1

WebView에서 사용자가 사용중인 장치를 기반으로 특정 URL을 표시하도록합니다. 예 :iPhone 및 iPad에서 다른 작업 수행

if(deviceType == iPad) 
{ 
    // Load Site on iPad & Retina iPad 
    [webView loadRequest:[URLWithString:@"http://site.com/ipad.html"]]; 
} 
else 
{ 
    // Load Site on iPhone & Retina iPhone 
    [webView loadRequest:[URLWithString:@"http://site.com/iphone.html"]]; 
} 

어떻게하면됩니까? 감사합니다 :)

답변

3

사용 뭔가 같은 :

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 

UI_USER_INTERFACE_IDIOM() 그 방법을 사용할 수없는 경우 대체과 함께 userInterfaceIdiom method of UIDevice를 호출하는 매크로입니다.