0

サブクラスがUITabBarControllerあり、次のコードを実行する必要があります。

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
} 

うまく機能し、デバイスを裏返すと回転します。私の問題は、アプリの一部で、ログイン画面などのすべての上にレイヤーを配置したいので、これを使用していることです。

LoginView *loginView = [[LoginView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame delegate:self];
[[UIApplication sharedApplication].keyWindow addSubview:loginView]; //<-- Won't rotate

//[self.view addSubview:loginView]; <-- will rotate but will not be on top of everything (tabbar etc')

その場合、ログイン画面は回転しません。すべてのレイヤーであるサブビューを作成し、他のすべてのビューのように強制的に回転させるにはどうすればよいですか?

4

0 に答える 0