IPad simulator / device uses iPhone storyboard

So, I created an iPhone app, and I wanted to convert it to an iPad by following the steps below.

  • Duplicate your iPhone storyboard and rename it MainStoryboard_iPad.storyboard

  • Open this file in any text editor.

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

  • Now save everything and run Xcode again β†’ iPad-Storyboard contains the same as the iPhone file, but everything can be frustrated

Everything is done correctly, but the image / iPad device in any case uses the iPhone storyboard. Any suggestions?

I installed the iPad layout in the summary -> ipad deployment information -> Main storyboard. And main.plist-> The main name for the storyboard file (iPad) is set to the iPad storyboard.

Please tell me what I am missing.

UPD . The interesting thing is, when I remove the name of the iPad storyboard from the ipad deployment information, it still uses my iPhone storyboard on the device.

enter image description here

enter image description hereenter image description here

enter image description here

+5
source share
2 answers

You can always select the appropriate storyboard in appDelegate and present the program controller for the corresponding root view.

@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;
}
+4
source

Remember to add the following things to the project.plist file (main name of the main storyboard file / base name of the main storyboard (iPad))

enter image description here

, .

+4

All Articles