简体   繁体   English

如何在单独的故事板Xcode6中为iPhone和iPad开发

[英]how to develop for iPhone and iPad in separated storyboards Xcode6

in Xcode5 I had two storyboards, one for iPad and one for iPhone 在Xcode5中,我有两个情节提要板,一个用于iPad,一个用于iPhone。

that sounds easier to watch the flow of the viewControllers, and because on iPhone you can't do the same thing you do in iPad (UIPopoverControllers, and other cool stuff) 这听起来更容易观看viewControllers的流程,并且因为在iPhone上您无法做与iPad中相同的事情(UIPopoverControllers和其他很棒的东西)

now in Xcode6 implemented universal storyboards which is good for some people, but what if you want to keep using separated storyboards, I can't see the option to set one StoryBoard for iPhone and other for iPad, all I see is this: 现在已经在Xcode6中实现了通用的故事板,这对某些人来说很不错,但是如果您想继续使用分离的故事板,我看不到为iPhone和iPad设置一个Storyboard的选项,我所看到的是:

在此处输入图片说明

just a main interface... how to change this as it was before??? 只是一个主界面...如何像以前一样更改它??? (two storyboards) (两个情节提要)

As of XCode 6, there is no longer an integrated way to do storyboards for different devices, but you can do a manual hack in your app delegate to use two different storyboards. 从XCode 6开始,不再存在用于不同设备的情节提要的集成方法,但是您可以在应用程序委托中进行手动修改以使用两个不同的情节提要。

First, create your second storyboard. 首先,创建第二个故事板。 You should have two storyboards now: Main~iPhone.storyboard and Main~iPad.storyboard (the names don't really matter). 您现在应该有两个故事板: Main〜iPhone.storyboardMain〜iPad.storyboard (名称并不重要)。

Then in your app delegate do this: 然后在您的应用程序委托中执行以下操作:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    UIStoryboard *storyboard;
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        storyboard = [UIStoryboard storyboardWithName:@"Main~iPad" bundle:nil];
    } else {
        storyboard = [UIStoryboard storyboardWithName:@"Main~iPhone" bundle:nil];
    }
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    [self.window makeKeyAndVisible];
    return YES;
}

(PD: You should learn about Adaptive UIs instead of following this approach. You would be able to use UIPopOvers and all the iPad's stuff with one universal storyboard - The iPhone would do things differently. For example, when in an iPad you choose to do a pop over, the iPhone will display a modal view). (PD:您应该了解自适应UI,而不是遵循这种方法。您将能够在一个通用情节提要板上使用UIPopOvers和所有iPad的东西-iPhone的处理方式会有所不同。例如,在iPad中,您选择执行弹出窗口时,iPhone将显示模式视图。

仍然适合我...但是我使用的是Deployment Target 6.0,而我的上一个发行版特别适用于iOS 8.1和iPhone6。我担心这可能是唯一的解决方案:-(您可以在其他参数中选择8.1进行编译,故事板等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM