【问题标题】:How to set a segue programatically如何以编程方式设置 segue
【发布时间】:2015-05-19 07:15:45
【问题描述】:

我正在使用 swift 开发一个 iOS 应用程序,并且我使用了 aUIContainerView。我为UIViewController 设置了一个segue,以嵌入UIContainerView

现在,我需要在点击UIButton 时更改此 UIViewController。那可能吗?如果可以,如何实现?

提前谢谢你。

【问题讨论】:

标签: ios swift uiviewcontroller uicontainerview


【解决方案1】:

您可以使用segueWithIdentifier:source:destination:performHandler: 方法以编程方式创建一个segue。您的执行处理程序应该完成在源视图控制器和目标视图控制器之间转换所需的所有工作。然后您可以使用UIViewControllerperformSegueWithIdentifier:sender: 方法以编程方式启动它

【讨论】:

  • 没有名为 segueWithIdentifier:source:destination:peformHandler 的方法
  • 此方法在 UIStoryboardSegue 类中声明。我提供了一个文档链接。
猜你喜欢
  • 1970-01-01
  • 2015-11-06
  • 1970-01-01
  • 2016-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-03
  • 2012-03-29
相关资源
最近更新 更多