ios - How can I change the text from another view controller? -
i'm trying
signupviewcontroller *useremail=[[signupviewcontroller alloc] init]; useremail.emailaddress.text=email;
but not working.
it seems emailaddress (assuming uitextfeild) not allocated when called
signupviewcontroller *useremail=[[signupviewcontroller alloc] init];
so, nil @ point of init.
better way be, added 1 public property in signupviewcontroller of nsstring. save value in property. below
signupviewcontroller *useremail=[[signupviewcontroller alloc] init]; useremail.emailstring=email;
in signupviewcontroller.h file add
@property (nonatomic, strong) nsstring *emailstring;
in signupviewcontroller.m file in view did load
- (void)viewdidload{ //if have not used nib or stroyboard init textfield first emailaddress.text=emailstring; }
Comments
Post a Comment