如何使用iPhone和iPad两个输出启动项目?
使用Pre Release Xcode 3.2.3我将其作为启动项目
alt text http://www.balexandre.com/temp/2010-04-17_1155.png 我应该选择/做一个能够同时将iPad和iPhone作为目标的项目(不是在iPad上显示iPhone应用程序而是在真正的iPad视图中)? 谢谢. 为了避免问题: > iPhone OS 3.1.3是iPhone上的最新版本 我的问题没有违反我和Apple必须达成的任何协议,因为我的问题是那些已经公开发布的问题. 我刚刚说过,在我的操作系统上,我正在运行Xcode 3.2.3,就是这样. 解决方法
刚发现一个简单的方法:
alt text http://www.balexandre.com/temp/2010-04-17_1242.png alt text http://www.balexandre.com/temp/2010-04-17_1241.png 然后,如果你想切换到每个设备的XIB文件,比如说,MainView for iPhone是A而MainView for iPad是B,你在AppDelegate中添加: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // The default have the line below,let us comment it //MainViewController *aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; // Our main controller MainViewController *aController = nil; // Is this OS 3.2.0+ ? #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) // It's an iPad,let's set the MainView to our MainView-iPad aController = [[MainViewController alloc] initWithNibName:@"MainView-iPad" bundle:nil]; else // This is a 3.2.0+ but not an iPad (for future,when iPhone runs with same OS than iPad) aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; #else // It's an iPhone (OS < 3.2.0) aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; #endif // Let's continue our default code self.mainViewController = aController; [aController release]; mainViewController.view.frame = [UIScreen mainScreen].applicationFrame; [window addSubview:[mainViewController view]]; [window makeKeyAndVisible]; return YES; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |