Reputation: 6614
I have an action that I need to have linked to a certain view in the Storyboard. The code I currently have below links to the Storyboard's first view. How would I link it to a certain view controller within the Storyboard? FYI - this link is coming from a xib file that's not part of the Storyboard and it works fine. thanks
- (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender
{
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController* initialHelpView = [storyboard instantiateInitialViewController];
initialHelpView.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:initialHelpView animated:YES];
}
I'm wondering if the method: instantiateViewControllerWithIdentifier: and then identifying one of the views in the storyboard would work.
- (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender
{
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// UIViewController* viewController = [storyboard instantiateInitialViewController];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"RotationVC"];
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:viewController animated:YES];
}
thanks for any help
Upvotes: 1
Views: 2468
Reputation: 6614
use the method: instantiateViewControllerWithIdentifier: and then identifying one of the views in the storyboard:
- (IBAction)continueWithoutLoginButtonTouchHandler:(id)sender
{
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// UIViewController* viewController = [storyboard instantiateInitialViewController];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"RotationVC"];
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:viewController animated:YES];
}
Upvotes: 2