There are four ways to pass values:
1. Attribute passing value 2. Single-pass value 3. Proxy value 4.block value one. Property pass-through value(front-to- back ) 1. The following interface defines a property to store the value passed over the previous interface Note : Whether a property is defined as a string or a different type depends on your needs 2. After the interface is created , assign a value to the property (record the value to be passed ) 3. Use the value of the attribute record where the value is needed4. The method of defining a property for the purpose of transmitting value is called a property pass valueProperty pass-through values are typically used to pass values from one interface to the previous onetwo. Single-pass values (universal pass-through values can be passed across multiple pages) 1. First define a singleton in this singleton with only one instance but can have multiple properties 2.static single *single=nil;
+ (single *) Sharesingle
{
@synchronized (self) {
if (Single==nil) {
Single=[[single alloc] init];
}
returnsingle;
}
3. Assign the value you want to pass to the attribute of D in the Singleton
Note: Single casetypically provides a class method to get this unique instance//But the drawing type is the type name of the class that starts with the default shared current standard, and so on Singleton A class has only one instancethe Singleton object is usually not released until the program exits three. Proxy Transfer value(after à ago ) 1.1. The latter interface defines a protocol and defines a property called delegate 2.2. In the previous interface into the second interface of the moment (after creating an interface , let the previous interface as the delegate of the latter interface ) 3.3. The previous interface implements the Proxy method4.4. The latter interface allows the agent to execute proxy methods at the appropriate opportunity (the value of the pass is included in the proxy method in the form of a parameter) Four. Block pass value (front and rear) 1. The next interface declares the Block property@property (nonatomic,copy) void (^chuanzhi) (NSString *_str); 2. Check if block is present in. m in the method of passing values if (_chuanzhi) {
_chuanzhi (_textfield.text);
_chuanzhi=nil;
}
3. The previous interface entered the next interface to implement the block in the method [(DVC) after an interface controller setchuanzhi:^ (NSString *_str) {
Dispatch_async (Dispatch_get_main_queue (), ^{
_LABEL.TEXT=_STR;
});
}];