Xcode 切换到横向时更改情节提要
当用户在AppDelegate.m文件中切换到横向到纵向模式时,有没有办法更改情节提要?我已经为不同的IOS切换到不同的情节提要,但我无法从横向切换到纵向模式。我已经构建了一个名为iPadios5横向的情节提要,我正在使用此功能切换到情节提要方法mainStoryboard=[UIStoryboard Storyboard,名称:@ipadios5横向束:nil];但我不知道如何检测方向。把它放在这个代码中是很重要的Xcode 切换到横向时更改情节提要,xcode,ipad,orientation,Xcode,Ipad,Orientation,当用户在AppDelegate.m文件中切换到横向到纵向模式时,有没有办法更改情节提要?我已经为不同的IOS切换到不同的情节提要,但我无法从横向切换到纵向模式。我已经构建了一个名为iPadios5横向的情节提要,我正在使用此功能切换到情节提要方法mainStoryboard=[UIStoryboard Storyboard,名称:@ipadios5横向束:nil];但我不知道如何检测方向。把它放在这个代码中是很重要的 if (SYSTEM_VERSION_GREATER_THAN_OR_EQUA
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")==NO)
{
if (iOSDeviceScreenSize.height == 480)
{
mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone_ios5" bundle:nil];
}
if (iOSDeviceScreenSize.height == 1024)
{
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == 0) //Default orientation
//UI is in Default (Portrait) -- this is really a just a failsafe.
mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad_ios5" bundle:nil];
else if(orientation == UIInterfaceOrientationPortrait)
//Do something if the orientation is in Portrait
mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad_ios5" bundle:nil];
else if(orientation == UIInterfaceOrientationLandscapeLeft)
// Do something if Left
mainStoryboard = [UIStoryboard storyboardWithName:@"iPadios5landscape" bundle:nil];
else if(orientation == UIInterfaceOrientationLandscapeRight)
//Do something if right
mainStoryboard = [UIStoryboard storyboardWithName:@"iPadios5landscape" bundle:nil];
}
这可能吗?将其粘贴在此处以检测方向,然后在设备方向为横向或纵向时设置情节提要
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == 0) //Default orientation
//UI is in Default (Portrait) -- this is really a just a failsafe.
else if(orientation == UIInterfaceOrientationPortrait)
//Do something if the orientation is in Portrait
else if(orientation == UIInterfaceOrientationLandscapeLeft)
// Do something if Left
else if(orientation == UIInterfaceOrientationLandscapeRight)
//Do something if right
我用了你的代码,把它和我的代码混在了一起。在我的问题中,检查一下。