不同的初始界面方向iPhone和iPad通用应用程序

时间:2013-07-13 09:07:37

标签: ios5 ios6

我想要的是iPhone的纵向和iPad应用的横向。 我的应用针对>
我在网上搜索了这个,但得到了不同的答案,但不是确切的答案。

2 个答案:

答案 0 :(得分:0)

所以这就是我所做的

对于iPhone enter image description here

和iPad enter image description here

对于iPad控制器,我添加了下面的代码,这对于应用程序来说不是必需的

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
            interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

答案 1 :(得分:0)

您应该只需将此代码添加到您的应用代理即可。

Swift代码:

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return Int(UIInterfaceOrientationMask.Portrait.rawValue)
    } else {
        return Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue | UIInterfaceOrientationMask.LandscapeRight.rawValue)
    }
}