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 //According to Segue ID execution Jump 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 #pragma mark-segue related 2-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {3 //Get target Controller 4 I D controller = Segue.destinationviewcontroller; 5 6 //Determine jump Target 7 if ([Controller Iskindofclass:[addviewcontroller class]) {8 //If "Add Contact" 9 Addviewcontroller *addviewcontroller = controller;10 addviewcontroller.delegate = self;11 }12 if ([Controller Iskindofclass:[editviewcontroller Class]]) {+/ /If "View/Edit Contact" Editviewcontroller * Editviewcontroller = controller;16 //Take out data nsindexpath *indexpath = [Self.tableview indexpathforselectedrow];19 editviewcontroller.contact = self.contacts[indexpath.row];20 // Set Agent editviewcontroller.delegate = self;23 }24 25}
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-16 Uistoryboardsegue object (Segue)