martes, 15 de septiembre de 2015

iOS: Add remove view controllers to navigation controller

Add view controller from storyboard
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[self navigationController] pushViewController:[storyboard instantiateViewControllerWithIdentifier:@"MainViewController"] animated:YES]; 

Remove view controller
b
Replace rootview controller
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController* viewController = [storyboard instantiateViewControllerWithIdentifier:@"new_root_view_controller"];
    
[[self navigationController] setViewControllers:@[viewController] animated:YES];

No hay comentarios:

Publicar un comentario