Forward-passing value Lan Yi education
Jump from Viewcontroller (Class A) to Secondviewcontroller (Class B) during a jump page
A Secondviewcontroller page created in Viewcontrolller
So, from the Viewcontroller to the second, the forward value is transmitted.
If it's text, then it's actually a string, so we're going to start with SecondViewController.h.
Build an attribute nsstring*accept. h is open and visible
So Viewcontrolller.
[Email protected] "111";
Secondviewcontroller *s2=[[secondviewcontroller Alloc]init];
S2.ns=self.l111.text;
[Self presentviewcontroller:s2 animated:yes completion:nil];
So in the second page can output [email protected] "111";
Reverse pass-through value
The first step
First, in Class B. h, add #import "Class A Viewcontroller"
Then create a Class A Viewcontroller property
@property (nonatomic,weak) Viewcontroller *l1;
Step Two
Creating a position setting for Class B Objects (B1) in Class A
b1.delegate=self;
Step Three
The method and method types used to establish a reverse value (call) in Class A are different depending on the purpose
-(void) fanxiangaction;
Fourth Step
In class B, the reverse value (the location of the call) is required to enable
[Self.delegat fanxiangaction];
Fifth Step
Receives the value of the called B in a method called by Class B in Class A, or implements the required method
-(void) {
}
IOS Learning Notes forward reverse exercise--Lan Yi Education