Skip to content

Instantly share code, notes, and snippets.

@modocache
Last active August 29, 2015 13:59
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 modocache/10565279 to your computer and use it in GitHub Desktop.
Save modocache/10565279 to your computer and use it in GitHub Desktop.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"user"]) {
// Type casts? I thought we were using a static language here?!
UserViewController *userViewController = (UserViewController *)segue.destinationViewController;
// I have to expose a property in order to configure the view controller.
// The view controller is in an invalid state prior to this assignment.
userViewController.user = self.selectedUser;
[self.navigationController pushViewController:userViewController animated:YES];
} else if ([segue.identifier isEqualToString:@"settings"]) {
// More of the same boilerplate...
SettingsViewController *settingsViewController = (SettingsViewController *)segue.destinationViewController;
settingsViewController.user = self.selectedUser;
settingsViewController.editable = self.loggedIn;
[self.navigationController presentViewController:settingsViewController animated:YES completion:nil];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment