0
如何設置我的項目配置以允許我的應用在iPhone 6+上的縱向和橫向上都可以工作& 7+型號和其他iPhone型號必須支持只有肖像?iOS應用僅適用於iPhone 6 +/7 +
如何設置我的項目配置以允許我的應用在iPhone 6+上的縱向和橫向上都可以工作& 7+型號和其他iPhone型號必須支持只有肖像?iOS應用僅適用於iPhone 6 +/7 +
use this third party lib for detecting the running device's model and screen size.
//AppDelegate.h
@property() BOOL restrictRotation;
//AppDelegate.m
@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;
}
}