简体   繁体   English

Swift ios dismissViewControllerAnimated与exit之间的区别

[英]Swift ios difference between dismissViewControllerAnimated and exit

As a newbie on ios dev I wonder what the difference between dismissViewControllerAnimated(true, completion: nil) and dragging a line to the "exit" in storyboard are? 作为ios dev上的新手,我想知道dismissViewControllerAnimated(true, completion: nil)和在storyboard中拖出一行到“exit”之间的区别是什么?

I have a view with a segue that leads into another view by modal presentation. 我有一个带有segue的视图,通过模态显示进入另一个视图。 Right now I am using dismissViewControllerAnimated(true, completion: nil) in order to go back to the prev VC. 现在我正在使用dismissViewControllerAnimated(true, completion: nil)以便返回到prev VC。 But I've seen som tutorials where they just drag a line to the exit icon/button in storyboard 但是我看过som教程,他们只是在故事板中拖动一行到退出图标/按钮

Dismiss不会让你准备放卷过程,它只会回到上一个视图,而从退出按钮创建segue让你有机会准备放卷过程,你可以将一些模型信息从被解除的视图传递到以前的观点。

When dragging a line, you are presenting the previous view a second time instead of just dismissing the new view to get back to the original. 拖动一行时,您将再次显示上一个视图,而不是仅仅关闭新视图以返回原始视图。 This method is not advised because it wastes memory every single time the exit button is clicked. 建议不要使用此方法,因为每次单击退出按钮都会浪费内存。 The previous view will keep on getting adding to the view stack which will accumulate memory. 上一个视图将继续添加到将累积内存的视图堆栈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM