【问题标题】:performSegueWithIdentifier Not Working - SwiftperformSegueWithIdentifier 不工作 - 斯威夫特
【发布时间】:2016-12-27 07:03:48
【问题描述】:

我正在尝试在用户成功创建帐户后启动 segue。我知道正在调用该函数,但未执行 segue。我尝试使用 presentViewController 作为替代方案,还尝试了 dispatch_async(dispatch_get_main_queue()) 方法。这是我认为应该可以工作的代码。

func showGoalViewController () {

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewControllerWithIdentifier("ID_SetGoalViewController") as! SetGoalViewController
    self.presentViewController(vc, animated: false, completion: nil)

}

这是我试图在故事板中调用的 segue 的屏幕截图:

【问题讨论】:

  • showGoalViewController() 不工作?
  • 我相信这个问题是指navigateToMainAppScreen() 不起作用。
  • 这个LoginViewController 是从包含“ShowSetGoal”segue 的情节提要中实例化的吗?
  • 在情节提要中,您需要将LoginViewControllerNavigationController 嵌入
  • 我也认为这是因为 segue.kind ,尝试不同的东西或使用 NavigationController

标签: ios swift storyboard segue


【解决方案1】:

那是因为没有 UINavigationController 就无法推送视图控制器。请放置 UINavigationController 或请设置 segue Kind "Modal" 而不是 "Push"

【讨论】:

  • 3 小时后的调试...... XCode 确实应该提供警告,说明情况确实如此。
猜你喜欢
  • 2016-02-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-07
  • 2017-07-22
  • 2017-03-24
相关资源
最近更新 更多