2016-11-24 5 views
0

내 앱이 iPhone에서 세로 및 가로로 모두 작동하도록 프로젝트 구성을 설정할 수 있습니까? & 7 개 이상의 모델 및 기타 iPhone 모델이 지원해야합니다. 초상화 만?iPhone 6 +/7 + iOS 전용 iOS 앱

답변

0

use this third party lib for detecting the running device's model and screen size.

//AppDelegate.h

@property() BOOL restrictRotation; 

//AppDelegate.m

수입 "AppDelegate.h"

수입 "SDVersion.h"

@ 구현 AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 

// Check for device model 
if ([SDiOSVersion deviceVersion] == iPhone7Plus){ 
    NSLog(@"You got the iPhone 7. Nice!"); 
    restrictRotation=YES; 
} 
else if ([SDiOSVersion deviceVersion] == iPhone6SPlus){ 
    NSLog(@"You got the iPhone 6S Plus. Awesome device!"); 
    restrictRotation=YES; 
} 


return YES; 
} 

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 
{ 
    if(self.restrictRotation) 
    { 
     return UIInterfaceOrientationMaskPortrait; 
    } 
    else 
    { 
     return UIInterfaceOrientationMaskAll; 
    } 

}