0

全方向で動作するアプリがあります。

iOS 6の場合、私は使用します

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

そしてiOS 5の場合

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

この部分は機能しているようです。

次に、回転アニメーションを停止したいので、これらのメソッドを実装します。

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

    [UIView setAnimationsEnabled:NO];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];

    [UIView setAnimationsEnabled:YES];
}

すべて問題ありませんが、UIAlert を表示してからデバイスを回転させると、背景の黒い影が間違った方向に表示されます。

スクリーンショット

これは iOS 6 でのみ発生し、iOS 5 ではなく、実際のデバイスとシミュレーターで発生し、回転がアニメーション化されないようにした場合にのみ発生します。

何か案が?

編集: ここで私の rootViewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Other things

    self.rootViewController = [[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]] autorelease];
    self.window.rootViewController = self.rootViewController;
    [self.window makeKeyAndVisible];

    return YES;
}

ウィンドウは NIB に保存されます。

4

1 に答える 1

0

この質問を閉じるには...

何が原因でこの問題が発生したのかはわかりませんが、iOS のバージョンが関係していると思われます。

カスタムアラート(のサブクラスUIViewController)を実装することで解決しました。

于 2013-11-22T10:37:58.217 に答える