Skip to content

Instantly share code, notes, and snippets.

@avanish
Last active February 15, 2017 08:40
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/e11b95fbda6f111228c7509aa73e616c to your computer and use it in GitHub Desktop.
Save avanish/e11b95fbda6f111228c7509aa73e616c to your computer and use it in GitHub Desktop.
UIViewController navigation without segue or parent UINavigationController
// UIViewController nagivation without the navigation controller.
// UIStoryboard->UINavigationController
//
// Initializations
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SecondViewController *svc = (SecondViewController *)[storyboard instantiateViewControllerWithIdentifier:@"identifierName"];
// Navigation
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController pushViewController:svc animated:YES];
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain
target:nil action:nil];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment