Objective c iOS 7中的定向问题

Objective c iOS 7中的定向问题,objective-c,xcode,ios7,orientation,Objective C,Xcode,Ios7,Orientation,我有一个奇怪的问题,我的应用程序处于横向模式。它在iOS 8中运行良好,但在iOS 7中,应用程序的第一个屏幕将进入纵向模式。若我推到另一个viewController并返回到第一个vc,那个么它将进入我想要的横向模式 - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape;

我有一个奇怪的问题,我的应用程序处于横向模式。它在iOS 8中运行良好,但在iOS 7中,应用程序的第一个屏幕将进入纵向模式。若我推到另一个viewController并返回到第一个vc,那个么它将进入我想要的横向模式

- (BOOL)shouldAutorotate
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

我还遇到了一个关于方向的问题。。。这就是iPhone

我记得在运行我的应用程序时,默认方向是纵向,而我想要的是将我的应用程序默认为横向模式。所以我把代码放在下面,它解决了我的问题

- (BOOL) shouldAutorotate {
    return YES;
}
- (NSUInteger) supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
shouldAutorotate返回YES,因为我希望它在第一次运行时在横向旋转


希望这个故事能帮助你,祝你好运。

当第一个屏幕初始化时,你能检查帧的值吗。