我有一个奇怪的问题,我的应用程序处于横向模式。它在iOS 8中运行良好,但是当涉及iOS 7时,应用程序的第一个屏幕进入纵向模式。如果我推送到其他viewController并返回到第一个vc,那么它将进入我希望的横向模式
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
答案 0 :(得分:2)
我也遇到了关于方向的问题......那就是iPhone。
我记得在运行我的应用程序时,默认方向是Portrait,当我想要的是在横向模式下默认我的应用程序。所以我把代码放在下面,它解决了我的问题。
- (BOOL) shouldAutorotate {
return YES;
}
- (NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
shouldAutorotate 返回YES,因为我希望它在首次运行时在Landscape中旋转。
希望这个故事对你有所帮助,祝你好运。