PrefaceApple has been launching the story version for a long time and has not studied in depth. Recently, I want to try to use storyboard to do high-Fidelity Interactive app prototype, decided to learn under. Compared to the IB, storyboard almost no handwritten code, it can achieve page interaction, which is very suitable for xcode students to do rapid prototyping.
implement a simple page jumpNew project, select Single View application,xcode the generated project template will automatically use storyboard. Open the Main.storyboard file, as you can with IB, Drag the View object to the Viewcontroller's view. , simply add a page labeled Uilabel tag and a UIButton button:
Drag a Uiviewcontroller object to the main window as the second page, hold down the CTRL key, drag the button to connect the newly added page
Release the mouse and select action Segue in the list of pop-up black hover boxes: Modal so that after clicking the Orange button, page 2 will pop up from the bottom of page 1
Page 2 back to page 1, add a button on page 2, implement a Ibaction method with Uistoryboardsegue type parameter in the VIEWCONTROLLER.M file
-(Ibaction) Unwindsegue: (Uistoryboardsegue *) sender{ NSLog (@ "Unwindsegue%@", sender);}
Ctrl connect the button on page 2 to exit Viewcontroller, and associate Unwindsegue: Method
Operating effects in the simulator:
Code ImplementationPage 1 jump page 2: First clear the button line, and then CTRL line Viewcontroller to ViewController2, select the modal type
Check the connection between Viewcontroller and ViewController2, and set the identifier for the connection: 2VC2
Add code to the VIEWCONTROLLER.M and associate the button
-(Ibaction) PresentVC2: (ID) Sender { NSLog (@ "Code implementation page Jump"); [Self performseguewithidentifier:@ "2VC2" Sender:sender];}
Page 2 back to Page 1, first clear the button line, and then add the Ibaction method in VIEWCONTROLLER2.M and associate the return button:
-(Ibaction) Backaction: (ID) Sender { [self dismissviewcontrolleranimated:yes completion:nil];}
A preliminary study on storyboard (i): Achieve simple page jump and return