Here is how to transition or Navigate from one iOS (iPhone or iPad) Storyboard UI Screen to other programatically by press of button

There are instances when you want to transition or navigate from one UI screen to other by press of button.

Yes you can link button visually by control clicking on button & then linking that button to required UI Screen on storyboard.

But I will show you how you can do it programatically with code defined & working differently for iPad & iPhone Storyboards.

I have used iOS Conditional coding syntax for differentiate iPhone & iPad Storyboards


Note: You can read about iOS Conditional Coding Here, How to detect user is using iPad or iPhone for iOS App at run time conditional coding purposes

Step 01: Use following code for your choice of UI Button IBAction Sender button


- (IBAction)exitButton:(id)sender {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        UIViewController *obj = [[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"ViewController"];
        [self.navigationController pushViewController:obj animated:YES];
    } else {
        UIViewController *obj = [[UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"ViewController"];
        [self.navigationController pushViewController:obj animated:YES];

Step 02: Now navigae to Storyboard right hand panel for ‘Storyboard ID Property’ which can be can be found in the Identity Inspector of the View Controller:


  1. Open up your storyboard in your Xcode project
  2. Make sure you have the Identity Inspector open on the right side panel i.e. Third icon at the top when you have the Utilities pane open
  3. The second section in the Identity Inspector is labeled “Identity”, The first property listed is Storyboard ID, You have to set the value of it to “ViewController”

Now you are good to go,

Try to run your app in simulator or on your device to check if it is working or not.

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply