troller与presentModalViewControll

troller与presentModalViewControll

本文介绍了iOS - pushViewController与presentModalViewController的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ <$ p <$ p <$ p <$ <$ p <$ p <$ < b $ b


  • 动画设置为NO(即使是,这只是一个可以更改的动画样式)。




这只是为了显示模态视图,因此也可以通过调用堆栈能否从第一个推视图回来? Woooaaaaaa .....



我猜这里的差异在别处和更深。否?

解决方案

最重要的区别是语义。模态视图控制器通常指示用户必须提供一些信息或做某事。此链接更深入地说明了此问题:



这里是另一个更抽象的区别:



当你提供一个模态视图控制器时,系统会在呈现的视图控制器和呈现的视图控制器之间创建一个父子关系,具体来说,它的modalViewController属性指向它的呈现(子)视图控制器。类似地,呈现的视图控制器更新其parentViewController属性以指向呈现它的视图控制器。



另请参阅此主题:


What is the difference beetween calling presentModalViewController and pushViewController, when :

  • animation is set to NO (even if yes, that's just an animation style that can be changed).
  • a navigation controller is defined when presenting the modal view, so it can be navigable too, with a call stack, ....

Is this just to be able to go back from the first pushed view ? Woooaaaaaa.....

I guess the difference is elsewhere and deeper. No ?

解决方案

The most important difference is about semantics. Modal view controllers typically indicate that the user has to provide some information or do something. This link explains it more in depth: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

Here's another, less abstract difference they talk about:

"When you present a modal view controller, the system creates a parent-child relationship between the view controller that did the presenting and the view controller that was presented. Specifically, the view controller that did the presenting updates its modalViewController property to point to its presented (child) view controller. Similarly, the presented view controller updates its parentViewController property to point back to the view controller that presented it."

Also see this thread: why "present modal view controller"?

这篇关于iOS - pushViewController与presentModalViewController的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:07