几分钟前我设置了 XCode 4.5 和 iOS6 模拟器。
我的应用支持所有 4 iPhone的方向,
纵向底部和顶部主页按钮,横向左右。
好吧,我把它放到了 .plist 中,因为它是 iOS6 所要求的,而且旧的 shouldRotateTo... 方法仍然在那里返回 YES。
但是在模拟器中,App是不是 旋转到纵向顶部主页按钮。
为什么?这是故意的吗?它会在设备上正常工作吗?
谢谢。
最佳答案
好的,
我现在自己找到了答案。
拥有是不够的
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
在您的 ViewController 中,如果它被插入
UINavigationViewController
.UINavigationViewController
还得有那些方法。最好,您可以通过在
UINavigationViewController
上设置一个小类别来做到这一点。 .这是我的
UINavigationController-Rotation.h
:@interface UINavigationController (Rotation)
@end
和我的 UINavigationController-Rotation.m:
#import "UINavigationController-Rotation.h"
@implementation UINavigationController (Rotation)
#pragma From UINavigationController
- (BOOL)shouldAutorotate {
BOOL result = self.topViewController.shouldAutorotate;
return result;
}
- (NSUInteger)supportedInterfaceOrientations {
NSUInteger result = self.topViewController.supportedInterfaceOrientations;
return result;
}
#pragma -
@end
谢谢你帮助我!
关于ios6 - iOS6模拟器中的顶部主页按钮纵向不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12503658/