iOS模态视图的使用方法

  •  一个视图控制器用另一个视图控制器的视图取代它自己的视图。这就是模态(modal)视图。

             A modal view (that is, a view presented modally) provides self-contained functionality in the context of the current task or workflow.

             明显的,模态视图打断了当前的视图堆栈,新生成了一个视图,这个视图当然也是有视图控制器的,你可以这么使用模态视图:


    •Use them to gather information from the user immediately.

    •Use them to present some content temporarily.

    •Use them to change work modes temporarily.

    •Use them to implement alternate interfaces for different device orientations.

    •Use them to present a new view hierarchy with a specific type of animated transition (or no transition).


              任何视图控制器都可以成为模态视图控制器。模态视图和普通视图之间的差异:

     

    \
     

    还是有些小差异的。

            模态视图的两个参数:

    modalTransitionStyle

          UIModalTransitionStyleCoverVertical

          UIModalTransitionStyleFlipHorizontal

          UIModalTransitionStyleCrossDissolve

          UIModalTransitionStylePartialCurl

    modalPresentationStyle

          UIModalPresentationFullScreen

          UIModalPresentationPageSheet

          UIModalPresentationFormSheet

          UIModalPresentationCurrentContext

    这两个参数是指过渡方式和最终的呈现方式。www.it165.net

            模态视图和显示出它的视图之间存在父子关系,一般都是通过父视图来显示和关闭:

            presentModalViewController:controller    animated:YES

            dismissModalViewControllerAnimated:YES

    模态视图控制器和UIPopoverController的主要不同是用户必须响应模态视图。

    模态对话框主要有UIAlertView, UIActionSheet, UILocalNotification。这个就不一一赘述了。

    关于模态视图其实有个最重要的问题是:为什么称为模态?还没想明白。

     

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值