展开搜索和弹出查看控制器之间有什么区别? [英] What's the difference between unwind segues and popping to view controllers?

查看:84
本文介绍了展开搜索和弹出查看控制器之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的应用程序将需要实现一个工作流,以允许用户以表格形式输入信息。我打算不使用滚动视图,而是将其分解为一堆单独的视图控制器,这些控制器将由导航控制器进行管理。我首先将所有表单片段放置在情节提要中,然后开始连接表单不同部分的所有推送和展开功能。

The app I'm working on will need to implement a workflow to allow users to enter information in a form. Instead of using a scroll view, I'm planning to break it up into a bunch of separate view controllers, which will be managed by a navigation controller. I started by laying out all the form fragments in a storyboard, and began connecting all the push and unwind segues for the different parts of the form.

我的问题是,如何是否比使用导航控制器的pushViewController和popToViewController方法并完全跳过情节提要更好地使用所有这些推入和放开搜索?内存管理或性能方面有什么区别吗?就设计和可维护性而言,不是简单地使用push和pop会是更好的做法吗?我在文档中找不到能解决这个问题的任何东西。

My question is, how is using all these push and unwind segues any better than simply using the pushViewController and popToViewController methods of my navigation controller, and skipping the storyboard altogether? Is there any difference in terms of memory management or performance? Wouldn't simply using push and pop be better practice in terms of design and maintainability? I can't find anything in the docs that addresses this.

推荐答案

在工作方式上基本上没有区别。使用展开功能的一件事是,您可以将数据传递回您要展开的控制器。如果使用pop方法,则必须创建一个委托协议来执行此操作。但这很多都是主观的。您可以使用对您而言更舒适的一种。我喜欢使用情节提要,因为它可以轻松查看控制器之间的关系。在大型团队中工作时,使用情节提要板可能是个问题(无论如何,我还是听说过),这是另一个考虑因素。

There's basically no difference in terms of what they do. The one thing that's good about using unwinds, is that you can pass data back to the controller you're unwinding to. If you use the pop methods, then you have to create a delegate protocol to do this. But a lot of this is subjective. You can use which ever is more comfortable for you. I like using the storyboard because it makes it easy to see the relationships between the controllers. Using storyboards can be a problem (so I've heard anyway) when you are working in a large team, so that's another consideration.

这篇关于展开搜索和弹出查看控制器之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆