Last active
December 19, 2015 05:09
-
-
Save scottsappen/5901913 to your computer and use it in GitHub Desktop.
Programmatically calling a Segue in iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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