xcode - Access button from different controller (Objective-C) -


i've started making app in xcode need access button on different controller. can set controllers class viewcontroller first one? or need create new class , link them how?

you can pass object of interest view controller view controller b this:

// in view controller - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {    if([[segue identifier] isequaltostring:@"seguefromatob"]) {        nsstring *myvalue = [_mytextfield text];      [(bviewcontroller *)[segue destinationviewcontroller] setmyvalue:myvalue];    } }  // in view controller b @interface bviewcontroller ()  @property (nonatomic, strong) nsstring *myvalue;  @end  - (void)viewdidload {    [super viewdidload];     // todo: evaluate myvalue here } 

don't forget give segue (represented line connecting 2 controllers) b id in storyboard (e.g. "seguefromatob")


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -