How to start a project with both iPhone and iPad outputs?

Using Pre Release Xcode 3.2.3, I get this as a launch project

alt text
(source: balexandre.com )

What should I choose / do in order to create a project in which both the iPad and the iPhone could be used as the target ( do not show the iPhone application on the iPad, but the real iPad View)?

Thanks.


To avoid problems:

  • iPhone OS 3.1.3 is the latest version on iPhone
  • iPhone OS 3.2 is the latest version on iPad

My question does not violate any agreements with which Apple and I are associated , as my question concerns these already public releases.

I just stated that on my operating system I use Xcode 3.2.3, that's all.

+2
iphone xcode ipad project
source share
2 answers

just found a simple way:

alt text http://www.balexandre.com/temp/2010-04-17_1242.png

alt text http://www.balexandre.com/temp/2010-04-17_1241.png

Then, if you want to switch to XIB files on the device, say, MainView for iPhone is A, and MainView for iPad is B, in 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 an iPad, let 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 an iPhone (OS < 3.2.0) aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; #endif // Let continue our default code self.mainViewController = aController; [aController release]; mainViewController.view.frame = [UIScreen mainScreen].applicationFrame; [window addSubview:[mainViewController view]]; [window makeKeyAndVisible]; return YES; } 
+11
source share

You can select Application Type as "Universal".

0
source share

All Articles