ios开发--模态视图
一个视图控制器用另一个视图控制器的视图取代它自己的视图。这就是模态(modal)视图。
Amodal 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
这两个参数是指过渡方式和最终的呈现方式。
模态视图和显示出它的视图之间存在父子关系,一般都是通过父视图来显示和关闭:
presentModalViewController:controller animated:YES
dismissModalViewControllerAnimated:YES
模态视图控制器和UIPopoverController的主要不同是用户必须响应模态视图。
模态对话框主要有UIAlertView, UIActionSheet, UILocalNotification。这个就不一一赘述了。
关于模态视图其实有个最重要的问题是:为什么称为模态?还没想明白。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。