【问题标题】:orientation issue in iOS 7iOS 7 中的方向问题
【发布时间】:2015-11-03 07:47:05
【问题描述】:

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

- (BOOL)shouldAutorotate
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

【问题讨论】:

  • 第一个屏幕初始化时你能检查帧的值吗?

标签: objective-c xcode ios7 orientation


【解决方案1】:

我还遇到了关于方向的问题……那是在 iPhone 中。

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

- (BOOL) shouldAutorotate {
    return YES;
}
- (NSUInteger) supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}

shouldAutorotate 返回 YES,因为我希望它在第一次运行时在横向中旋转。

希望这个故事对你有所帮助,祝你好运。

【讨论】:

    猜你喜欢
    • 2013-11-17
    • 2016-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-30
    • 2013-10-14
    • 2023-03-12
    • 1970-01-01
    相关资源
    最近更新 更多