UIViewController跳转(模态modal)

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中实现,有利于数据交换和代码阅读。

 

posted on 2013-12-09 15:40  EnamelPot 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/EnamelPot/p/3465529.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值