One, the middle pass value
Global variables
1. Store the median value (delegate--is more troublesome)
@property (Nonatomic,strong) NSString *labeltext;
2. Save the value (put in the Application object)
Yyappdelegate *appdelegate = [UIApplication sharedapplication].delegate;
Appdelegate.labeltext = Label.text;
3. Fetching data
Yyappdelegate *appdelegate = [UIApplication sharedapplication].delegate;
Label.text =appdelegate.labeltext;
Second, forward value
A->b
Local variables
1. Set a property in B to save the value LabelText
@property (Nonatomic,strong) NSString *labeltext;
2. Save value (before VA jumps to VB)
Yygreenviewcontroller *green = [[Yygreenviewcontroller alloc]init];
Green.labeltext = Label.text;
3. Fetch the data and set
Label.text =self.labeltext;
Third, the value of the reverse transmission
Protocol: Proxy (reverse pass value)
A <-b
1. Create the Protocol agent (. h), and declare the method (what to do, with the parameter value-is the value you want to pass),
2. Set the agent properties in B. h
@property (nonatomic,weak) id< Agreement name >delegate;
and ————— stored value (. m) before the interface jumps
[Self.delegate method Name: What to save];
3.A (. h) Compliance Agreement
4. Obtain an agent in (. m),
Yygreenviewcontroller *b = [[Yygreenviewcontroller alloc]init];
B.delegate = self;
5. How to get the value to implement the Protocol (a)
UI Basics--(5) Uiviewcontroller, intermediate pass value, forward value, reverse pass value