ios - 如何更改 Storyboard流程

标签 ios swift uiviewcontroller storyboard segue

我必须修改基于旧应用程序中 Storyboard显示的 ViewController 的流程。

假设 Storyboard显示屏幕如下:

screen A -> screen B -> screen C -> screen D

现在的修改是,根据特定条件,不应显示屏幕 C。假设,如果条件为真,则显示屏幕 C,否则不为真,则直接显示屏幕 D。

流程应该是:

                        /-------false--\ 
                       /                \
                      /   true           \
screen A -> screen B ---------> screen C ----> screen D

我在屏幕 B 和屏幕 D 之间创建一个 segue。如果条件为 true,我什么都不做(显示屏幕 C,然后显示屏幕 D),如果条件为 false,我在屏幕 B 的 ViewController 中调用 segue:

  performSegue(withIdentifier: "DirectlyDisplayScreenD", sender: self)

差不多可以工作了...屏幕C显示半秒,然后出现屏幕D。

我是 iOS 初学者,我所做的至少在原则上是正确的吗?

屏幕 C 短暂显示是否有明显原因?是因为 Storyboard吗?或者调用 segue 还不够?或者这是否意味着屏幕 C 的 ViewController 在代码中的某处实例化?

有没有办法删除 Storyboard的 ViewController ?我找到了方法instantiateViewController但我没有找到方法“removeViewController”

最佳答案

我自己解决了这个问题。我删除了遗留的转场并再次重新构建了它,并为他起了一个名字。之后,应用程序将遵循我希望的流程。

谢谢大家的建议!!

关于ios - 如何更改 Storyboard流程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51046209/

相关文章:

ios - TableView 在 Swift 中丢失选定的行

iphone - "Pushing the same view controller instance more than once is not supported"异常

ios - 添加一个 uilabel 没有改变的 uiviewcontroller

ios - UILabel 文本的多种文本颜色在 swift 3.0 中不起作用

ios - 自动布局 "conflicting constraints"

ios - 更新 Kinvey 上的现有用户

swift - UINavigationBar foregroundColor 使用 Color 而不是 UIColor

iphone - 警告 : Attempt to present <CustomViewController> on <UINavigationontroller> whose view is not in the window hierarchy

ios - 运行 iOS 8.3 的 iPhone 在 Xcode 6.2 中显示为不合格

android - 如何在 android 和 ios 上运行 angular 7 应用程序?