奇怪iOS6的自动旋转的Bug
我使用这个类支持在iOS设备自动旋转6奇怪iOS6的自动旋转的Bug
@implementation UINavigationController (RotationIn_IOS6)
-(BOOL)shouldAutorotate
{
NSLog(@"Last Object is %@",[[self.viewControllers lastObject] description]);
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
我的应用程序设置是这样用的导航控制器旋转此
- 显示密码屏幕工作正常,这两个(模拟器,设备)。
- 验证用户,并显示主屏幕旋转只能在模拟器不是设备
-(BOOL)shouldAutorotate
在主屏幕 任何人知道如何解决这个实施?
根据this question的回答,使用Category来重写Cocoa类中的方法是一个坏主意。 '关于在运行时使用哪种方法实现的行为未定义'。
我使用UINavigationController的子类来实现你正在尝试做的事情,并且没有任何问题,所以我建议你尝试一下。
相同的代码工作在iPad Mini ios 6.0.1 – 2013-05-10 11:58:51
不同的硬件... 'undefined'行为... – 2013-05-10 12:13:34
也许是由于iPhone是JailBroken ...反正会在非越狱设备上测试,然后在这里更新这个帖子 – 2013-05-10 12:17:35
实际问题是什么? – 2013-05-10 10:56:53
您是否已在您的“主屏幕”视图控制器中实施了' - (NSUInteger)supportedInterfaceOrientations'? – 2013-05-10 11:12:30
设备的iOS版本是什么? – 2013-05-10 11:24:50