Skip to content

Instantly share code, notes, and snippets.

@matteom
Created November 19, 2013 17:30
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 matteom/7549107 to your computer and use it in GitHub Desktop.
Save matteom/7549107 to your computer and use it in GitHub Desktop.
Configuring the managed object context and the delegate for the new controller
// In PCLeadsViewController
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"DisplayLeadSegue"]) {
PCLeadViewController *leadViewController = segue.destinationViewController;
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
leadViewController.lead = self.leads[selectedRowIndexPath.row];
} else {
PCNewLeadViewController *newLeadViewController = segue.destinationViewController;
newLeadViewController.managedObjectContext = self.managedObjectContext;
newLeadViewController.delegate = self;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment