5

So I've created an app for iPhone and I wanted to convert it to iPad, by following steps from this answer.

  • Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard

  • Open this file any text editor.

  • Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad"

  • Now save everything and reopen Xcode -> the iPad-Storyboard contains the same as the iPhone-file but everyting could be disarranged

Everything is done correctly but iPad simulator/device anyways uses iPhone storyboard. Any suggestions?

I've set iPad storyboard in summary->ipad deployment info->Main storyboard. And main.plist-> Main storyboard file base name (iPad) is set to iPad storyboard.

Please tell me what I am missing.

UPD. Interesting Thing, when I delete iPad storyboard name from ipad deployment info it still uses my iPhone storyboard on device.

enter image description here

enter image description here enter image description here

enter image description here

Community
  • 1
  • 1
Vlad Z.
  • 3,401
  • 3
  • 32
  • 60

2 Answers2

4

Dont forget to add following things in project's info.plist file (Main Storyboard file base name/ Main Storyboard file base name (iPad))

enter image description here

Hope this helps.

Kunal
  • 649
  • 4
  • 13
  • yes, info-> Main storyboard file base name (iPad) is set to iPad storyboard. – Vlad Z. Mar 19 '13 at 15:07
  • This was exactly my problem. Xcode set Main nib file base name (iPad) to Main-iPad.storyboard instead of the correct Main storyboard file base name (iPad) when I upgraded the app to universal. – Dustin May 04 '14 at 18:38
4

You could always pick the proper storyboard in the appDelegate and present the appropriate root view controller programatically

@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
    UIViewController *rvc;
}

Implementation

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
       UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IPAD_Storyboard" bundle:nil];
       rvc = [storyboard instantiateViewControllerWithIdentifier:@"identifierForController"];
    }
    else {
       UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
       rvc = [storyboard instantiateViewControllerWithIdentifier:@"identifierForController"];
    }


    [self.window addSubview:rvc.view];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return YES;
}
j_mcnally
  • 6,928
  • 2
  • 31
  • 46