Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad simulator/device uses iPhone storyboard

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 hereenter image description here

enter image description here

like image 906
ignotusverum Avatar asked Mar 19 '13 14:03

ignotusverum


2 Answers

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;
}
like image 143
j_mcnally Avatar answered Oct 24 '22 16:10

j_mcnally


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.

like image 20
Kunal Avatar answered Oct 24 '22 17:10

Kunal