2

Using the Pre Release Xcode 3.2.3 I get this as a Startup Project

alt text
(source: balexandre.com)

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)?

Thank you.


To avoid problems:

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

My question does not infringe any agreements that me and Apple are bound to, as my question is regarding those already public Releases.

I just stated that on my Operating System I'm running the Xcode 3.2.3, that is all.

Community
  • 1
  • 1
balexandre
  • 73,608
  • 45
  • 233
  • 342
  • That information is under NDA by Apple. You shouldn't ask public questions regarding it, nor may anybody here legally answer questions about it. – Claus Broch Apr 17 '10 at 10:11
  • @Claus, running iPad and iPhone is PUBLIC as you can do that already with iPhone 3.1.3 and iPad 3.2, I just stated that my XCode is 3.2.3 version! As KennyTM states, 3.2 is Released to public (it's the iPad OS) !!! – balexandre Apr 17 '10 at 10:27
  • 1
    possible duplicate of http://stackoverflow.com/questions/2547315/what-are-the-build-settings-for-a-universal-iphone-and-ipad-application – kennytm Apr 17 '10 at 10:28
  • The latest public version of Xcode is 3.2.2, pre-release Xcode 3.2.3 is not public – Claus Broch Apr 17 '10 at 22:35
  • no matter what version of XCode is, the question is regarding the Universal Output not that this XCode is more/better than the others! – balexandre Apr 17 '10 at 23:15

2 Answers2

11

just found out 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 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;
}
balexandre
  • 73,608
  • 45
  • 233
  • 342
  • you don't need that `#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200` crap. As long as you use Base SDK 3.2, `UI_USER_INTERFACE_IDIOM()` will work correctly on pre-3.2 devices – user102008 Mar 12 '11 at 00:58
0

You can choose the Application Type as "Universal" .

Akshay
  • 2,973
  • 6
  • 43
  • 75