: It is to pass the value of the first interface to the second interface for display. Its simple implementation method is as follows:
// Create the second VC
TRsceondViewController * sceondViewController = [[TRsceondViewController alloc] initWithNibName: @ "TRsceondViewController" bundle: nil];
// Sets the second VC effect.
SceondViewController. modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// Send the text value to the public attribute message in the second VC. The label in the second VC cannot be directly accessed.
SceondViewController. message = self. sendField2.text;
// Jump to the created VC interface
[Self presentViewController: sceondViewController animated: YES completion: nil];
}
: Click a button on the first interface to jump to the second interface. Then, return the value of the second interface to the first interface and display it. Its simple implementation method is as follows:
Self. firstViewCtroller. userInputMessage = self. textField. text;
// After this statement is executed, dealloc is called to release TRSecondViewController.
[Self dismissViewControllerAnimated: YES completion: nil];
}
: In reverse value passing, we know that the second interface (the entrusting party) can return a value to the first interface. If there are a lot of values that need to be obtained from the entrusting party like the first interface, we know that in the entrusting party, we have a property that can receive a fixed interface property. If there are multiple properties, we cannot write multiple such properties. This is obviously inappropriate, here we need to use the Protocol to solve this problem. The specific method is as follows: