nik
nik

Reputation: 2329

iPhone storyboard present a model view Programmatically

Am Developing a iphone appliction using this storyboard concept.

Here I have done the initial-view present using this storyboard.

Here I have created a button in rootviewcontroller programatically on user clicking on this button i should present another view controller lets say root2ViewController. Am using below code the present the view but its not presenting anything and it says like identifier not found. Any solution and idea will be appreciated.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                     bundle:[NSBundle mainBundle]];
UIViewController *root2ViewController = [storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
[root2ViewController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:root2ViewController animated:animation completion:nil];

Upvotes: 2

Views: 1458

Answers (2)

nik
nik

Reputation: 2329

I Found the solution calling this below method in action is did the magic.

[self performSegueWithIdentifier: @"FindMyClinic" sender: self];

Upvotes: 0

user1078170
user1078170

Reputation:

In the inspector window in you storyboard you need to set the storyboard identifier of you view controller

Upvotes: 1

Related Questions