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,然后将装置转动时,背景上的黑色阴影出现在方向错误。
这种情况只有在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。
你是如何将'rootViewcontroller'设置为'UIWindow'的?可能你做错了。 – holex
@holex请看看我的编辑。 – Beppe