There are 8 ways in which page values are transmitted.
-. Attribute pass value (forward pass value)
Declare a property in AttributeVC.h to receive the value passed in.
In ROOTVIEWVC.M, assign a value
Use this value in ATTRIBUTEVC.M
Two. Proxy pass value ())
First define and declare the proxy in the second page DelegateVC.h,
Why delegate (proxy) properties are assign instead of retain
Circular references
All reference counting systems have problems with cyclic applications. For example, the following reference relationship:
• Object A was created and referenced to object B.
• Object B was created and referenced to object C.
• Object C was created and referenced to object B.
At this time, the reference counts for B and C are 2 and 1, respectively. When a no longer uses B, the call release releases the ownership of B, because C also references B, so the reference count for B is 1,b and will not be freed. B is not released, the reference count of C is 1,c and will not be released. From then on, B and C remain in memory forever.
In this case, the circular reference must be interrupted and the reference relationship maintained through other rules. For example, our common delegate is often a property of the Assign mode rather than the Retain method, and the assignment does not increase the reference count to prevent unnecessary circular references on both sides of the delegation. If a Uitableviewcontroller object a acquires ownership of UITableView object B through retain, the delegate of this UITableView object B is a, and if this delegate is retain mode, There's basically no chance of releasing these two objects. You should also be aware of this when designing your delegate model.
Because the memory leaks generated by circular references are instrument, you should be very careful
Determine the existence of proxy objects in DELEGATEVC.M, bind the corresponding methods
And then in RootViewVC.h.
Specifying the agent in ROOTVIEWVC.M and executing the proxy method
Three. Block pass value (reverse value)
In
In BlockPassValue.h
In the BLOCKPASSVALUE.M
Transfer of values between controllers