Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Storyboard-view manually

I have an application using Storyboard. On a view there is an AlertViewDialog.

When the user clicks the first button ("Yes"), how can I open an other view on the Storyboard?

like image 783
Rick de Jong Avatar asked Jan 17 '13 14:01

Rick de Jong


2 Answers

my be this can help :

  1. Drag a View in Then go to Identity Inspector (Shortcut: option+apple+3).
  2. Select the newly dragged View and give unique name from identify inspector in title Storyboard ID . // see the image for reference enter image description here

create SecondViewController class (.h &.m) subclass of viewController .

then from alert view code (as you said when YES is clicked )

paste the code mentioned below

SecondViewController *svc =[self.storyboard instantiateViewControllerWithIdentifier:@"vinay"];
        [svc setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
        [self presentViewController:svc animated:YES completion:nil];

let me know if any issues occur.

like image 50
Vinay Chopra Avatar answered Sep 28 '22 09:09

Vinay Chopra


May this helps:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ClassNameViewController *viewController = (ClassNameViewController *)[storyboard instantiateViewControllerWithIdentifier:@"viewIdentifierOnStoryboard"];
[self presentModalViewController:viewController animated:NO];
like image 21
Tchelow Avatar answered Sep 28 '22 09:09

Tchelow