I'm developing an Universal App in iOS SDK 8.3 and I'm using UISplitViewController. For some reasons I want to enable landscape orientation only for iPads and iPhone 6 Plus.
I can't find out a proper way to obtain this and for the moment I'm using this 'poor' work around that overrides a function of UIApplicationDelegateProtocol
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)
{
if (window.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiomUnspecified)
return UIInterfaceOrientationMaskAll;
if (window.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
if (window.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular)
return UIInterfaceOrientationMaskAllButUpsideDown;
//iPhone 6 plus detected.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone
&& MAX([UIScreen mainScreen].bounds.size.height,[UIScreen mainScreen].bounds.size.width) == 736)
return UIInterfaceOrientationMaskAll;
return UIInterfaceOrientationMaskPortrait;
}
Is there an elegant and 'safe' way to obtain the same result?