Skip to content

Instantly share code, notes, and snippets.

@avanish
Created February 2, 2017 08:34
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 avanish/8a55e8770e3281cd4462f851127f18b8 to your computer and use it in GitHub Desktop.
Save avanish/8a55e8770e3281cd4462f851127f18b8 to your computer and use it in GitHub Desktop.
UINavigationController->UIViewController navigation without segue
// UIStoryboard->UINavigationController->UIViewController
//
// Initializations
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *controller = (UINavigationController *)[storyboard instantiateViewControllerWithIdentifier:@"identifier"];
SecondViewController *svc = (SecondViewController *)controller.topViewController;
// Passing data
svc.some_code = self.object.some_code;
// Navigation
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController presentViewController:controller animated:YES completion:nil];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment