Ios5 不同的初始界面定位iPhone和iPad通用应用程序

Ios5 不同的初始界面定位iPhone和iPad通用应用程序,ios5,ios6,Ios5,Ios6,我想要的是iPhone的纵向和iPad应用程序的横向。 我的应用针对> 我在网上搜索了这个问题,但得到了不同的答案,但不是确切的答案。我就是这么做的 对于iPhone 而iPad呢 对于我在下面代码中添加的iPad控制器,应用程序不需要这样做 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation

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

我就是这么做的

对于iPhone

而iPad呢

对于我在下面代码中添加的iPad控制器,应用程序不需要这样做

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

您只需将此代码添加到您的应用程序代理中,就可以做到这一点

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)
    }
}