Value three scenarios:
1. Attribute pass-through value (formerly passed back)
Requirements: The Second Interface tab displays the text of the first interface input box.
The first step is to define the properties in the previous interface. (The semantic attribute is declared as copy);
The second step is to pass in the data to the property before entering the next interface.
The third step is to read the data in the latter interface.
2. Proxy transfer value (from back to forward)
Demand:
The first step: Define the protocol in the latter interface, and define a method that has a parameter that has the same parameter type as the value type;
Step Two: Define the proxy properties. The semantic attribute is assign, the type is ID, and the protocol is obeyed .id<xxxdelegate>;
Step three: Look for the proxy object (before push) to specify the proxy object as the previous interface for the latter interface.
Fourth step: Obey the corresponding protocol (directly after the extension of the. m file);
The fifth step: Implement the method in the Protocol;
Sixth step: Tell the Proxy object when (timing) to execute the method in the protocol (Do security processing, respondsto);
Block Pass value (value from forward)
Pending completion.
3. Interval multiple Interface values: The method---single-pass value (similar to the property value).
The first step is to create a singleton class .
Step two : define the method for creating the singleton.
+ (Singleton *) Mainsingleton;
The third step is to define the properties that store the transferred data .
Defining attributes in the. h file
@property (nonatomic, copy) NSString *text;
When implemented in. m files, be aware of the addition of thread protection. (because there may be cases where the singleton has not yet been created, the access is performed.) A single thread ensures that the method created before the access is definitely done, that is, the singleton has been created.)
StaticSingletonnil;//ensures that the singleton is created when the first initialization is made.
+ (Singleton *) Mainsingleton {
@synchronized(self) {
if (! Single) {
single = [[Singleton alloc] init];
}
}
return single ;
}
Summary of how to transfer values between iOS learning pages