Skip to content

Instantly share code, notes, and snippets.

@Qiki
Last active December 26, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qiki/7130103 to your computer and use it in GitHub Desktop.
Save Qiki/7130103 to your computer and use it in GitHub Desktop.
Using Segue in ViewController
//call the segue to put the data you want to transfer
- (IBAction)click{
[self performSegueWithIdentifier:@"PUSH_NEXT"
sender:[NSDictionary dictionaryWithObjectsAndKeys:
self.page.data,@"data",nil]];
}
//prepareForSegue - tranfer the data to next viewController and push to the next view controller
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"PUSH_NEXT"]) {
NextPageViewController *vc = [segue destinationViewController]; //set destination view controller
vc.data = [sender objectForKey:@"data"]; //tranfer the data in the current view controller into next view controller,need to set the property in next page first
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment