[Solved] how to pass data b/w two view controllers? [duplicate]


In story Board you can send value one view to another view like Bellow way. Your Implement method did Wrong.

in you Second view-controller you need to define NSString with property and sythsize it.

.h class

@property (nonatomic, strong) NSString *YourString;

.m Class

@synthesize YourString;

Now you can use it like:-

-(IBAction)youMethod:(id)sender
{
    [self performSegueWithIdentifier:@"secondview" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
            if ([segue.identifier isEqualToString:@"secondview"]) {
         secondviewcontroller *controller = segue.destinationViewController
                controller.YourString = @"myValue";
             }

}

1

solved how to pass data b/w two view controllers? [duplicate]