A. The Jump event line in the concept storyboard is a Uistoryboardsegue object (Segue) source controller that triggers the controller Segue's properties that the director of the destination controller jumps to: Each Segue object has 3 properties
Uniquely identifies
@property (nonatomic, readonly) NSString *identifier;
SOURCE Controller
@property (nonatomic, readonly) ID Sourceviewcontroller;
Target controller @property (nonatomic, readonly) ID Destinationviewcontroller; B. Type 1. Automatic action Segue use controls to connect a jump (such as a button) that does not require conditional judgment: press control, drag the line from the control (switch, button, etc.) to the target Controller 2. Manual Type Manualmanual Segue use of the controller connection need to make certain conditions to determine the jump (using code) manual segue need to set the identity, at the time of development in the source controller execution Segue sample:
1 // perform a jump based on the segue ID 2 [Self Performseguewithidentifier:@ "contactlist" Sender:nil];
3. Pass data in Segue ready, jump before you perform the method of the source controller, using the member properties to pass the data prepareForSegue:sender:sample:
1 #pragmaMark-segue related2- (void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {3 //get the target controller4 IDController =Segue.destinationviewcontroller;5 6 //Judging jump targets7 if([Controller Iskindofclass:[addviewcontrollerclass]]) {8 //if "Add Contacts"9Addviewcontroller *addviewcontroller =Controller;TenAddviewcontroller.Delegate=Self ; One } A - if([Controller Iskindofclass:[editviewcontrollerclass]]) { - //if "View/edit Contacts" theEditviewcontroller *editviewcontroller =Controller; - - //Remove Data -Nsindexpath *indexpath =[Self.tableview Indexpathforselectedrow]; +Editviewcontroller.contact =Self.contacts[indexpath.row]; - + //Set up proxy AEditviewcontroller.Delegate=Self ; at } - -}There are 2 main cases of data transfer between controllers: smooth and reverse transmission
Shun Chuan
Direction of the controller's jump: A C
Direction of data transfer: A C
Data transfer method: In a Prepareforsegue:sender: method according to segue parameters obtained Destinationviewcontroller, that is, controller C, directly to the Controller C pass data ( To get the data in the Viewdidload method of C to assign a value to the UI control on the interface)
Direction of the controller's jump: A C
Direction of data transfer: C A
How the data is passed: Let A be the agent of C, call A's proxy method in C, pass the data to a by the parameters of the proxy method
[iOS base Control-6.11.4] Storyboard Segue