Controller data transmission and controller Data Transmission
Controller Data Transmission
There are two main data transmission situations between controllers: downstream and reverse transmission.
1. Shun Chuan
Controller jump direction: A --> C
Data Transmission Direction: A --> C
Data transmission method: Get destinationViewController, that is, controller C, in the prepareforseue: sender: Method of A, based on the seue parameter, and pass data directly to Controller C.
(To obtain data in the viewDidLoad method of C, assign a value to the UI control on the Interface)
2. Reverse Transmission
Controller jump direction: A --> C
Data Transmission Direction: C -->
Data transmission method: let A become the proxy of C, call the proxy method of A in C, and pass data to A through the parameters of the proxy method
The target controller transmits data to the source Controller called inverse transmission. First, the source controller must have an attribute or method to accept the data transmitted by the target controller. Then, the source controller directly calls this method or assigns a value to the attribute. Then, the target controller must have a source controller that allows the source controller in the target controller to call methods or attributes.