ユーザーが AppDelegate.m ファイルで横向きモードから縦向きモードに切り替えたときにストーリーボードを変更する方法はありますか 別の iOS 用に別の StoryBoards に切り替えるように既に作成しましたが、横向きモードから縦向きモードに切り替えることはできません。iPadios5landscape
このメソッドでストーリーボードに切り替えていmainStoryboard = [UIStoryboard storyboardWithName:@"iPadios5landscape" bundle:nil];
ますが、向きを検出する方法がわかりません。そして、このコードに配置することが重要です
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];
}
これは可能ですか?