用于推送与模态segue的用例? [英] Use case for push versus modal segues?

查看:103
本文介绍了用于推送与模态segue的用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个场景(带有导航栏的推视控制器),它在表格视图中显示一些表格数据。
在那个场景的导航栏中,我有一个+号,它应该打开一个新场景,用户可以在其中添加一个新项目(行到核心数据表)。
在表格视图中,每行在每个单元格的右侧都有一个箭头,这会打开一个场景,用户可以在其中编辑该特定项目的详细信息。
我应该使用push或modal segue作为+吗?
我应该使用推动或模态segue箭头吗?
什么是最佳做法?
我理解push和modal segues之间的区别,但我想知道哪种更适合上述用例。

Let's say, I have a scene (pushed view controller with a navigation bar), which displays some tabular data in a table view. In the navigation bar of that scene I have a + sign, which should open a new scene, where the user can add a new item (row to a core data table). In the table view, each row has an arrow on the right side of each cell, which opens a scene where the user can edit that particular item's details. Should I use a push or modal segue for the +? Should I use a push or modal segue for the arrow? What is the "best practise"? I understand the difference between push and modal segues, but I want to know which is better suited for the above use cases.

推荐答案

如果您想遵循Apple的最佳做法,我建议如下:

If you want to follow Apple's best practices, I would suggest the following :


  1. 对于添加功能,请使用模态 segue。

    例如,查看联系人应用。按+显示模态视图控制器。

    逻辑是什么?开始时,模态视图控制器通常有一个取消按钮,而不是按下推动的vc上的后退按钮。

    当用户按下后退时 - 他希望有一种方法可以来回到vc。通常返回会将您的数据保存在iOS上(自动保存)。

    因此,通过使用模态segue,您可以强制用户提交表单,或取消。模态演示提示您确实需要填写此屏幕。

  1. For the "Add" functionality, use a modal segue.
    For example look at the contacts app. Pressing + shows a modal view controller.
    What's the logic ? for start, modal view controllers usually have a "cancel" button, as opposed to the "back" button on a pushed vc.
    When the user presses "back" - he'd expect a way to come back to the vc. Usually "back" saves your data on iOS (auto-saved).
    So by using a modal segue you force the user to submit the form , or cancel. The modal presentation hints that you really need to fill this screen.

进行编辑 - 推送。但模态也可以工作(你可以重复使用相同的VC)。

推送的理由:

For editing - push. but modal could work as well (and you could reuse the same VC).
Reasons for push :


  • 你获取vc的层次结构,在向下钻取时前后移动。

  • (你应该实现)返回时自动保存(就像其他iOS应用程序一样)

这篇关于用于推送与模态segue的用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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