温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ios开发--模态视图

发布时间:2020-06-22 14:16:59 来源:网络 阅读:1225 作者:zmhot88 栏目:移动开发

         一个视图控制器用另一个视图控制器的视图取代它自己的视图。这就是模态(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).

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

ios开发--模态视图

还是有些小差异的。

        模态视图的两个参数:

modalTransitionStyle

      UIModalTransitionStyleCoverVertical

      UIModalTransitionStyleFlipHorizontal

      UIModalTransitionStyleCrossDissolve

      UIModalTransitionStylePartialCurl

modalPresentationStyle

      UIModalPresentationFullScreen

      UIModalPresentationPageSheet

      UIModalPresentationFormSheet

      UIModalPresentationCurrentContext

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

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

        presentModalViewController:controller    animated:YES

        dismissModalViewControllerAnimated:YES

 

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

 

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

 

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

 

 

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI