Differentiate between iPhone & iPad Storyboard in iOS

ios, storyboard

Solution

Try this one.

In your `AppDelegate` method first define this one:

#define IPHONE_STORYBOARD_NAME  @"Main_iPhone";
#define IPAD_STORYBOARD_NAME    @"Main_iPad";

Then declare this method:

+ (NSString *)storyboardName
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       return IPHONE_STORYBOARD_NAME;
   } else {
       return IPAD_STORYBOARD_NAME;
   }
}

Where you want call this `storyboardName` method

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil];

I think this will helps you :)

Problem

I am working on `Storyboard`. I have 2 story board for iPhone & iPad. So my question is how can I differentiate between these 2 interfaces. I am share my code what I did: ``` // I am writing this code in AppDelegate Method. UIStoryboard *loStoryboard ; if (loStoryboard == [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil]) { // iPhone ..... } else { // iPad.... } ``` But it's not working.

Original source

Related problems