Converting an iPhone app to Universal in Xcode 4

北城余情 提交于 2019-12-08 05:13:17

问题


I could use a little clarity here. I've opened a project that is a completed iPhone app. Then selected the target, selected "Universal" from the Summary/Devices dropdown, and followed the prompt to "Make a Universal App." Xcode created a folder "iPad" with the file "MainWindow-iPad.xib" within. Fine.

Now I duplicated all of my other nib files, and added "-iPad" after their name. I.e. "MySpecialVC.xib" was duped and renamed "MySpecialVC-iPad.xib." The thought was that Xcode knows some zoodoo about finding the correct xib for the device. Not so fine.

Then I read that the "-iPad" had to be "~ipad" (tilde, then lower-case ipad). This solved the problem with some of the xibs, but not all of them.

Dang if I can't figure this out. Is there a RIGHT way to do this?


回答1:


When I create a new universal project, I get this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
    } else {
        self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
    }
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

So it's clear the code is explicitly choosing a xib file. Is this not the case for your project?



来源:https://stackoverflow.com/questions/7211636/converting-an-iphone-app-to-universal-in-xcode-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!