1.presentViewController
新建2个viewcontroller a和b
a弹出b 则a为presenting view controller b为presented view controller
-(void)someButtonClicked { [self presentViewController:self.aVC animated:YES completion:^{ }]; }
2.Modal Presentation Styles(弹出风格)
设置presented VC的modalPresentationStyle属性
UIModalPresentationFullScreen;//默认;
弹出VC时,presented VC充满全屏,如果弹出VC的wantsFullScreenLayout设置为YES的,则会填充到状态栏下边,否则不会填充到状态栏之下。
其余几个皆为ipad所有,用时查看文档。
3.Modal Transition Style(弹出时的动画风格)
设置presented VC的modalTransitionStyle属性
//默认。底部滑入 UIModalTransitionStyleCoverVertical; //水平翻转进入 UIModalTransitionStyleFlipHorizontal; //交叉溶解 UIModalTransitionStyleCrossDissolve; //翻页 UIModalTransitionStylePartialCurl;
4.Dismiss Modal ViewController(消失弹出的VC)
[self dismissViewControllerAnimated:YES completion:^{ }];
已作优化在弹出的vc中执行这句,会自动通知其presentingViewController,但更推荐使用代理,即在presentedViewController中设委托 在presentingViewController中实现,有利于数据交换和代码阅读。