Knowledge points
1.UIStoryBoard Introduction
2. Uistoryboard interface Jump
3. Uistoryboard the value between interfaces
=========================
Uistoryboard Introduction
Uistoryboard is a new way that you can use to define the user interface, like Xib. Unlike Xib, it can manage multiple viewcontroller at the same time, and you can configure a jump relationship between Viewcontroller in Uistoryboard. If the main window has only one view controller as the first interface of the Uistoryboard, you need to tick the Initial Scene. Uistoryboard integrates all the xib files in the original project, and creates a jump relationship between the two viewcontroller by dragging and dropping, making the UI jump logic of the whole program clear. With Uistoryboard, the interface-related code will be written less.
1. If the main window has only one view controller as the first interface of story board, you need to tick the Initial Scene.
Select is initial view controller the current scene becomes the first scene to enter the application
2. In Uistoryboard, you can customize the cell directly on the UITableView
=========================
Uistoryboard interface Jump
3. Note the difference between push and present
1). Push corresponds to pop,present corresponding to dismiss;
2). Present can only step back, push all views are controlled by the view stack, you can return to the previous level, or you can return to the root VC, other VCs.
3). Present is typically used for switching between different business interfaces, and push is typically used for switching between different interfaces of the same business.
4. How to jump to a controller that is not connected
1) + (Uistoryboard *) Storyboardwithname: (NSString *) name Bundle: (NSBundle *) Storyboardbundleornil;
function: Gets a corresponding Uistoryboard object
2)-(ID) Instantiateviewcontrollerwithidentifier: (NSString *) identifier
Function: Obtain a controller with identifier ID in the file of the Uistoryboard //Jump to an disconnected controller
1 //Get Main.storyboard2 3Uistoryboard *storyboard = [Uistoryboard storyboardwithname:@"Main"Bundle:nil];4 5 6 7 //obtaining the corresponding controller object via Storyboardid8 9Uiviewcontroller *ctl = [StoryBoard instantiateviewcontrollerwithidentifier:@"CTLC"];Ten One A - //Code Jump - the[Self.navigationcontroller Pushviewcontroller:ctl Animated:yes];
6. How to go back to the previous interface
Implement a method in the upper level view controller to meet the format
-(Ibaction) + any method name + (Uistoryboardsegue *) + any variable name
// Uistoryboard Connection Bounce Method -(Ibaction) Unwindingsegue: (Uistoryboardsegue *) segue{ NSLog (@ " Sourceviewcontroller =%@ Destinationviewcontroller =%@", Segue.sourceviewcontroller, Segue.destinationviewcontroller); // function: In the reverse pass-through value will be applied to }
=========================
Uistoryboard the value between interfaces
1. Positive Pass Value
-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) sender
action: Called when the scene is about to be switched
// when the interface (Push,present) is switched on, the following method is called -(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: ( ID) sender{ // forward pass value if ([segue.identifier isequaltostring:@ " Login"]) { *ctl = segue.destinationviewcontroller; // Assign Value = self.userNameTF.text; = self.passWordTF.text; }}
2. Reverse value (traditional block, protocol agent, Notification Center, single-pass value still works)
-(Ibaction) Unwind: (Uistoryboardsegue *) Segue
Function: Called when returning to the previous scene
//the method of Uistoryboard in the connection//the method of jumping back is implemented before the connection-(Ibaction) Unwindingsegue: (Uistoryboardsegue *) segue{//Reverse Pass Value (Uistoryboard dedicated)//determine whether the click is registration complete if([Segue.identifier isequaltostring:@"Finish"]) { //rigorous if([Segue.sourceviewcontroller Iskindofclass:[registerviewcontrollerclass]]) {Registerviewcontroller*ctl =Segue.sourceviewcontroller; //Refresh UISelf.userNameTF.text=Ctl.userNameTF.text; Self.passWordTF.text=Ctl.passWordTF.text;//function: In the reverse pass-through value will be applied to } }}
iOS Development-ui (vii) StoryBoard