问题描述
使用Pre Release Xcode 3.2.3我将其作为启动项目
Using the Pre Release Xcode 3.2.3 I get this as a Startup Project
我应该选择/做一些能够同时将iPad和iPhone作为目标的项目(不在iPad上显示iPhone应用程序,而是真正的iPad视图)?
What should I chose / do to great a project that can have both iPad and iPhone as a target (not showing the iPhone App on iPad but a real iPad View)?
谢谢。
为避免出现问题:
- iPhone OS 3.1.3 是iPhone上的最新版本
- iPhone OS 3.2 是iPad上的最新版本
- iPhone OS 3.1.3 is the latest release on iPhone
- iPhone OS 3.2 is the latest release on iPad
我的问题不会侵犯我和Apple必然会达成的任何协议,因为我的问题是那些已经公开的发布。
My question does not infringe any agreements that me and Apple are bound to, as my question is regarding those already public Releases.
我刚刚说过,在我的操作系统上,我正在运行Xcode 3.2.3,就是这样。
I just stated that on my Operating System I'm running the Xcode 3.2.3, that is all.
推荐答案
刚刚找到一个简单的方法:
just found out a simple way:
然后,如果你想切换到每个设备的XIB文件,比方说,MainView for iPhone是A和Ma inView for iPad是B,在你的AppDelegate中添加:
Then, if you want to switch to XIB files per device, let's say, the MainView for iPhone is A and the MainView for iPad is B, in your AppDelegate you add this:
- (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;
}
这篇关于如何用iPhone和& ;;两个输出开始一个项目iPad的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!