设备旋转不工作在IOS 6在IOS工作得好5我做错了什么?

问题描述:

-(BOOL)shouldAutorotate 
{ 


    if (appDelegate.isOrientationSupport) 
    { 
     return YES; 
    } 
    else 
    { 
     return NO; 
    } 

} 

-(NSInteger)supportedInterfaceOrientations{ 
    NSInteger mask = 0; 
    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight]) 
     mask |= UIInterfaceOrientationMaskLandscapeRight; 
    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeLeft]) 
     mask |= UIInterfaceOrientationMaskLandscapeLeft; 
    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortrait]) 
     mask |= UIInterfaceOrientationMaskPortrait; 
    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortraitUpsideDown]) 
     mask |= UIInterfaceOrientationMaskPortraitUpsideDown; 
    return mask; 
} 

我在哪里做错了?设备旋转不工作在IOS 6在IOS工作得好5我做错了什么?

在AppDelegate中
+0

对不起,我读的问题是错误的。这不是重复的。什么是isOrientationSupport – 2013-04-24 07:56:39

+0

这是确定旋转打开或关闭的标志 – charithsuminda 2013-05-02 05:52:35

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window // iOS 6 
{ 

return UIInterfaceOrientationMaskAll; 
} 

在你的ViewController:

-(BOOL)shouldAutorotate { 
return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations { 
return UIInterfaceOrientationMaskPortrait; 
} 
+0

我认为值得注意的是ViewController代码必须包含在每个您想要旋转的ViewController中。另外,如果您使用的是UITabBarController,并且希望它旋转,那么在该UITabBarController中的每个子ViewController都必须实现上述方法。 [Here](http://developer.apple.com/library/ios/qa/qa1688/_index.html)是排除与设备旋转相关的所有类型问题的好帖子。 – codeqi 2013-04-25 00:31:50