Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my app, I do it like this. I create separate .h, .m and XIB files for iPad views and then in AppDelegate I simply make an if condition, which decides which view controller it will show.<br> Btw. I don't use those suffixes on XIBs, I name them to what I want to. </p> <p>My AppDelegate.h file (a part of it)</p> <pre><code> @class FirstViewController; @class FirstIpadViewController; ....... ....... @property (nonatomic, retain) IBOutlet FirstViewController *viewController; @property (nonatomic, retain) IBOutlet FirstIpadViewController *ipadViewController; </code></pre> <p>My AppDelegate.m file (a part of it)</p> <pre><code>if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; } else { self.window.rootViewController = self.ipadViewController; [self.window makeKeyAndVisible]; } </code></pre> <p>This should definitely do it. Just change the class and the property in .h file, to your view controller and you should be good to go :)</p> <p><strong>EDIT</strong></p> <p>I have just found out how to do it. And the proper naming conventions are _iPhone and iPad. This is basically the same as I posted above, only change is that it will have the same .h and .m files, but different XIBs. </p> <p>In the AppDelegate .m file</p> <pre><code> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil]; } else { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil]; } self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload