Getting an instance of UIStoryboard programmatically

suggest change

SWIFT:

Getting an instance of UIStoryboard programmatically can be done as follows:

let storyboard = UIStoryboard(name: "Main", bundle: nil)

where:

For example, you can use the instance created above to access a certain UIViewController instantiated within that storyboard:

let viewController = storyboard.instantiateViewController(withIdentifier: "yourIdentifier")

OBJECTIVE-C:

Getting an instance of UIStoryboard in Objective-C can be done as follows:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

Example of accessing UIViewController instantiated within that storyboard:

MyViewController *myViewController = [storyboard instantiateViewControllerWithIdentifier:@"MyViewControllerIdentifier"];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents