What is Segue
? Each line on the storyboard for interface jumps is a Uistoryboardsegue object (abbreviated segue)
Segue of the Properties
? Each of the Segue objects has 3 propertiesuniquely identifies
@ Property (nonatomic,readonly) nsstring*identifier;
Source Controller
@ Property (nonatomic,readonly) IDsourceviewcontroller;
Target Controller
@ Property (nonatomic,readonly) IDdestinationviewcontroller;
Segue of type
? According to Segue's execution (jump) moment, segue can be divided into 2 major typesAuto-type: After clicking on a control (such as a button), automatic execution of Segue, auto-complete interface JumpManual type: Need to write code to manually perform segue to complete the interface jump
Automatic Type Segue
? Control-Drag the line directly from the controls to the target controller
Click the "Sign in" button and it will automatically jump to the controller on the right.? If you click on a control, you do not need to make any judgment, be sure to jump to the next interface, it is recommended to use the "automatic type Segue"
Performseguewithidentifier:sender:
? Use Performseguewithidentifier: method can execute a segue, complete interface jump? Next study Performseguewithidentifier:sender: The complete execution of the method
[ self performseguewithidentifier:@ "login2contacts"sender:Nil ];
// this Self is the source controller
1. According to identifier to find the corresponding line in the storyboard, create a new Uistoryboardsegue objectset the Sourceviewcontroller of the Segue object (source Controller)New and set Destinationviewcontroller (target controller) for the Segue object
Performseguewithidentifier:sender:
2. Call Sourceviewcontroller The following method, do some pre-jump preparation and pass in the created Segue object
-(void) Prepareforsegue: (uistoryboardsegue*) Segue sender: (ID) sender;
// this Sender was the original Performseguewithidentifier:sender : in the incoming Sender
3. Call the-(void) Perform of the Segue object; method starts to perform interface jump operation(1) If the style of segue is pushget the Uinavigationcontroller where Sourceviewcontroller is locatedcall Uinavigationcontroller's Push method to press the Destinationviewcontroller into the stack to complete the jump(2) If Segue's style is modalCall Sourceviewcontroller's Presentviewcontroller method to show Destinationviewcontroller
Sender Passing of parameters
[ self performseguewithidentifier:@ "login2contacts"sender:@ "Jack"];
-(void) Prepareforsegue: (uistoryboardsegue *) Segue sender: (ID) sender;
Uitabbarcontroller
like Uinavigationcontroller, Uitabbarcontroller can easily manage multiple controllers, easily switch between controllers, typically QQ, and other applications
Uitabbarcontroller the simple use
? Uitabbarcontroller steps to useInitialize uitabbarcontroller set the Rootviewcontroller for UIWindow to uitabbarcontroller Depending on the case, add the corresponding number of sub-controllers by the Addchildviewcontroller method
? There are 2 ways to add a uitabbarcontroller controlleradding a single child controller
-(void) Addchildviewcontroller: (uiviewcontroller *) Childcontroller;
set up a sub-controller array
@property (nonatomic,copy) Nsarray*viewcontrollers;
? If Uitabbarcontroller has n sub-controllers, there will be N Uitabbarbutton as child controls inside Uitabbar ? If the Uitabbarcontroller has 4 sub-controllers, the structure of the Uitabbar is roughly as shown
App mainstream UI Frame Structure
Modal
? In addition to push, there is another way to switch the controller, that is modal? Any controller can be displayed in the form of modal.? Modal default effect: The new controller drills up from the bottom of the screen until it covers the previous controller? Display the controller in the form of a modal
-(void) Presentviewcontroller: (uiviewcontroller*) viewcontrollertopresent animated: (BOOL ) Flagcompletion: (void (^) (void)) completion
? Shut down the modal controller .
-(void) dismissviewcontrolleranimated: (BOOL) flagcompletion: (void (^) (void )) completion;
13.ios Controller Management 2