I'm currently stuck on an issue, I have Mainstoryboard.storyboard for the iPhone I also have set up MainStoryboardiPad for iPad to which all looks fine, but when I implement the code below from a full work ipad screen, I the Iphone screen at top left of iPad.

Can anyone help with this please or if you know the correct way of getting both storyboards to work?

    Job *consignment = self.job[indexPath.section];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    MsMenuController *controller = [storyboard instantiateViewControllerWithIdentifier:@"MsMenuController"];
    controller.consignment = consignment;
    [self.navigationController pushViewController:controller animated:YES];

If I change the storyboardWithName:@"MainStoryboard" to storyboardWithName@"MainStoryboardiPad" it works fine but I need to beable to run on both devices.

1

There are 1 best solutions below

1
On BEST ANSWER
NSString *storyboardName = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone
                               ? @"MainStoryboard" : @"MainStoryboardiPad";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];

Or you can probably get away with using self.storyboard instead.