我使用这个类别来支持ios 6中的自动旋转
@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
在主屏幕上有人知道如何解决这个问题吗?
发布于 2013-05-10 11:40:19
根据this question的答案,使用一个类别覆盖Cocoa类中的方法是个坏主意。“对于在运行时使用的方法实现,行为没有定义”。
我使用UINavigationController的子类来实现您想要做的事情,并且没有遇到任何问题,所以我建议您尝试这样做。
https://stackoverflow.com/questions/16480613
复制相似问题