2016-11-24 11 views
0

のiOSアプリのポートレートとランドスケープのiOSアプリは、iPhoneで縦と横の両方で動作するようにプロジェクト設定を設定できますか?& 7つ以上のモデルと他のiPhoneモデルがサポートしていますポートレートだけ?iPhone 6 +/7 +

答えて

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"

@implementation 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; 
    } 

} 
関連する問題