Recently, just contact with iOS development, there is no good book to read, all the functions can only be achieved by their own groping. These two days in a number of pages between the jump and the transfer of value issues,
Page jump See me another article http://blog.csdn.net/xiaotanyu13/article/details/7711954
will now use delegate to pass the value
First look at the resources on the Internet some can not understand, always feel very advanced appearance
Later on, the essence of delegate is actually:
For example, right AB two pages, a want to pass a value to B, just first in a to get a pointer B, and then assign the value you want to pass to B, then jump,
Don't talk more about the code
First we need to build a delegate:
@protocol passvaluedelegate
-(void) SetValue: (NSString *) value;
@end
In fact, this is primarily to better manage what values you need to pass and then define them in A.h.
@interface a:tttableviewcontroller{
Id<passvaluedelegate> passdelegate;
}
@property (nonatomic, retain) id<passvaluedelegate> passdelegate;
Inside the a.m.
@synthesize passdelegate;
(My class is not intuitive enough to pick someone else's text) and then when the need to jump, buttonclicked: (ID) sender{
b *_b = [[B alloc] init];
Self.passdelegate = _b;//interact with B here, the next line of code is the corresponding assignment
[Self.passdelegate Setvalue:need_pass_value]; Inside the B.h.
@interface B:nsobject <PassValueDelegate> {
nsstring* _value;
}
-(void) SetValue: (NSString *) value;
Inside the B.M.
-(void) SetValue: (NSString *) value{
_value = value;
}
When these functions are implemented
You get a value from a in B, which is the _value variable.
IOS delegate to implement values between pages