Three ways iOS develops jump scenes October 17, 2012, 15:32
Suppose a jumps to B, three ways:
1. Hold down the CTRL key, drag the control on a (for example, UIButton) to B, pop-up menu, select Modal. No need to write any code, click on a button on a to jump to B
2. Hold down the CTRL key, drag the view controller on a to B, pop-up menu, select modal, add connection lines and icons automatically between two scenes, select the icon, open storyboard Segue,identifier Enter an identifier, AAAA "for example. When a is required to jump, execute the following code:
1 |
[Self performseguewithidentifier:@ "AAAA" sender:self]; |
3. Fully implemented in code, with the following code:
123456789 |
Get Uistoryboard object First, parameter is filename uistoryboard *mainstoryboard=[uistoryboard storyboardwithname:@ "Mainstoryboard" Bundle:nil]; Get Secondviewcontroller instance, parameter is storyboard ID, check view Controller, Secondviewcontroller in Identity Inspector * Second=[mainstoryboard instantiateviewcontrollerwithidentifier:@ "Second"]; Set the style of the transition, and display the style second.modaltransitionstyle=uimodaltransitionstylefliphorizontal; Second.modalpresentationstyle=uimodalpresentationformsheet; Show [self Presentviewcontroller:second animated:yes completion:nil]; |
Three ways iOS develops jump scenes