0

Should I make 2 separate app delegates for a universal app? One myAppDelegate, then myAppDelegate_iPhone and myAppDelegate_iPad which are subclasses? Reason being iPhone should have IBOutlet of NavController while iPad should be UISplitViewController.

Also, how do I separate actions between iPhone and iPad. For example, a button on iphone may push a view, but on iPad i want to have a small window popup instead rather than a full-screen push. Do I just use a if/else statement to check if iPad (by uiswitchviewcontroller), then go from there?

if (NSClassFromString(@"UISplitViewController") != nil && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        //currentDeviceType = iPad;
    }
    else {
        //currentDeviceType = iPhone;
    }
Jon
  • 4,732
  • 6
  • 44
  • 67

3 Answers3

0

This question seems to be along similar lines.

Universal iPhone/iPad AppDelegate

This doc from Apple might also prove helpful.

Introduction to Universal Apps

Community
  • 1
  • 1
Manish Burman
  • 3,069
  • 2
  • 30
  • 35
0

No need to take two separate application delegates. You can code on the condition...

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){}

This will automatically detect the device.

alloc_iNit
  • 5,173
  • 2
  • 26
  • 54
  • So I can add UINavigationController and UISplitScreenController to my app delegate in 1 file? – Jon Aug 05 '11 at 04:32
  • Yes you can. Just you have to set proper Outlets and maintain application delegate code accordingly. – alloc_iNit Aug 05 '11 at 04:36
0

To enable rotation on the device, you need to return YES to

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

FOR ALL OF YOUR VIEW CONTROLLERS.

You should also add your supported orientations to your plist or info under xcode 4.

Also keep in mind that stack overflow prefers that a new question be asked when the question topic changes :)

cdasher
  • 3,083
  • 1
  • 19
  • 20