在Xcode 4中将iPhone应用程序转换为Universal [英] Converting an iPhone app to Universal in Xcode 4
问题描述
我可以在这里使用一点清晰度。
我已经开了一个项目,这是一个完整的iPhone应用程序。然后选择目标,从摘要/设备下拉列表中选择通用,然后按提示制作通用应用程序。
Xcode创建了一个文件夹iPad,其中包含MainWindow-iPad.xib文件。
罚款。
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.
现在我复制了所有其他nib文件,并在其名称后添加了-iPad。即MySpecialVC.xib被欺骗并重命名为MySpecialVC-iPad.xib。想到的是,Xcode知道一些关于为设备找到正确xib的zoodoo。
不太好。
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.
然后我读到-iPad必须是~ipad(代字号,然后是小写的ipad)。这解决了一些xib的问题,但不是全部。
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?
推荐答案
当我创建一个新的通用项目时,我明白了:
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;
}
因此很明显代码明确选择了一个xib文件。这不是你的项目的情况吗?
So it's clear the code is explicitly choosing a xib file. Is this not the case for your project?
这篇关于在Xcode 4中将iPhone应用程序转换为Universal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!