Skip to content

Instantly share code, notes, and snippets.

@scottsappen
Last active December 19, 2015 05:09
Show Gist options
  • Save scottsappen/5901913 to your computer and use it in GitHub Desktop.
Save scottsappen/5901913 to your computer and use it in GitHub Desktop.
Programmatically calling a Segue in iOS
[self performSegueWithIdentifier:@"SegueHomeToOwnerDetail" sender:self];
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"SegueHomeToOwnerDetail"]) {
NSLog(@"prepareForSegue called for SegueHomeToOwnerDetail");
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
OwnerViewController *ownerViewController = [segue destinationViewController];
ownerViewController.myObject = [_activeArray objectAtIndex:selectedRowIndex.row];
} else {
NSLog(@"prepareForSegue called for SegueHomeToParticipantDetail");
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
ParticipantViewController *participantViewController = [segue destinationViewController];
participantViewController.myObject = [_activeArray objectAtIndex:selectedRowIndex.row];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment