转载自
http://www.devdiv.com/home.php?mod=space&uid=13654&do=blog&id=6380
iOS视图切换相关总结
||
/*
* 个人笔记,如果有误,请站内PM。或
* lxs_lover520#qq#com
*/
目前,iOS中视图切换主要存在两种方式:基于UINavigationController的pop和push方式以及采用UIViewController的presentModalViewController方式。
第一种方式.......(请参考网络上各种文章)
这里谈谈第二种方式,在帮助文档中提到:
When you present a view modally using the
presentModalViewController:animated:
method, the view controller animates the appearance of the view using the technique you specify. (You can specify the desired technique by setting the modalTransitionStyle
property.) At the same time, the method creates a parent-child relationship between the current view controller and the modal view controller.
也就是说,使用presentModalViewController:animated:方法来实现视图切换的同时,也在当前视图控制器以及模态视图控制器之间构造了父子关系。(以前没有意识到这点)
其次,帮助文档中还提及:
modalViewController is always presented full screen. On iPad, the presentation depends on the value in the
modalPresentationStyle
property.(在iPhone和iPod设备上,modalViewController的视图一直时铺满整个屏幕的。而在iPad设备上则取决于modalPresentationStyle属性)