1. modal a controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ControllerA *ca = [storyboard instantiateViewControllerWithIdentifier:@"ControllerA"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ca];
ca.modalPresentationStyle = UIModalPresentationFullScreen; // 全屏视图显示
ca.modalTransitionStyle = UIModalTransitionStyleCoverVertical; // 从下向上滑出
// modal
[self presentViewController:nav animated:YES completion:NULL];
2. dismiss a modal controller
[self dismissViewControllerAnimated:YES completion:NULL];
3. push a controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ControllerA *ca = [storyboard instantiateViewControllerWithIdentifier:@"ControllerA"];
// push
[self.parentViewController.navigationController pushViewController:ca animated:YES];
4. pop a controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ControllerA *ca = [storyboard instantiateViewControllerWithIdentifier:@"ControllerA"];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:ca];
popover.popoverContentSize = CGSizeMake(320, 480);
// pop
[popover presentPopoverFromBarButtonItem:item
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
5. dismiss a pop controller
[self.popover dismissPopoverAnimated:YES];