简体   繁体   中英

how to develop for iPhone and iPad in separated storyboards Xcode6

in Xcode5 I had two storyboards, one for iPad and one for 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)

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:

在此处输入图片说明

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.

First, create your second storyboard. You should have two storyboards now: Main~iPhone.storyboard and Main~iPad.storyboard (the names don't really matter).

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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