iOS Storyboards
Introduction
Storyboards were introduced in iOS 5, and when using Storyboards, the deployment target should be iOS 5.0 or later.
Storyboards help us visualize the flow of screens in the interface.
Example Steps
Create a single view application, and select the storyboard checkbox when creating the application.
Select MainStoryboard.storyboard, where you can find a single view controller. Add a view controller and update the view controller as shown below.
Connect the two view controllers. Right-click the "show modal" button and drag it from the left view controller to the right view controller, as shown below.
Now select "modal" from the three display options shown below.
Update ViewController.h as shown below:
#import <UIKit/UIKit.h> @interface ViewController : UIViewController -(IBAction)done:(UIStoryboardSegue *)seque; @end
Update ViewController.m as shown below:
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(IBAction)done:(UIStoryboardSegue *)seque{ [self.navigationController popViewControllerAnimated:YES]; } @end
Select "MainStoryboard.storyboard" and right-click the "Exit" button, then select and connect the back button in the right view controller, as shown below.
Output
Run the application on an iPhone device to get the following output:
Now, select the modal display to get the following output: