2013-08-31 39 views
0

我有一個適用於所有方向的應用程序。iOS 6:UIAlertView旋轉問題

對於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]; 
} 

一切都OK,但如果我表現出UIAlert,然後將裝置轉動時,背景上的黑色陰影出現在方向錯誤。

Screenshot

這種情況只有在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。

+0

你是如何將'rootViewcontroller'設置爲'UIWindow'的?可能你做錯了。 – holex

+0

@holex請看看我的編輯。 – Beppe

回答

0

要關閉這個問題...

我不知道什麼是導致此問題的問題,我想相關的iOS版本的東西。

我解決了它通過實現我的自定義警報(UIViewController的子類)。