bal*_*dre 2 iphone xcode project ipad
使用Pre Release Xcode 3.2.3我将其作为一个启动项目
替代文字http://www.balexandre.com/temp/2010-04-17_1155.png
我应该选择/做一个能够同时将iPad和iPhone作为目标的项目(不是在iPad上显示iPhone应用程序而是在真正的iPad视图中)?
谢谢.
为了避免问题:
我的问题没有违反我和Apple必须达成的任何协议,因为我的问题是那些已经公开发布的问题.
我刚刚说过,在我的操作系统上,我正在运行Xcode 3.2.3,就是这样.
bal*_*dre 11
刚发现一个简单的方法:
替代文字http://www.balexandre.com/temp/2010-04-17_1242.png
替代文字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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3648 次 |
| 最近记录: |