【问题标题】:Popping out storyboard and moving back to previous viewcontroller (nib)弹出故事板并返回到以前的视图控制器(笔尖)
【发布时间】:2020-08-07 18:04:41
【问题描述】:

我有一个故事板项目,我想将它集成到一个现有的具有 nib 和视图控制器的项目中。

我已使用以下视图控制器之一推送情节提要:

let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()!
    viewController.modalPresentationStyle = .fullScreen
    self.present(viewController, animated: false, completion: nil)

我怎样才能从故事板移回前一个视图控制器,我添加了后退按钮,按下后退按钮我正在执行下面的代码,但它没有弹出。

 @IBAction func goBack(sender: UIButton) {
    self.navigationController?.popViewController(animated: true)
}

【问题讨论】:

    标签: ios swift iphone


    【解决方案1】:

    使用dismiss(animated:) 方法。

    @IBAction func goBack(sender: UIButton) {
        dismiss(animated: true)
    }
    

    【讨论】:

      猜你喜欢
      • 2012-03-29
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-02
      • 1970-01-01
      • 2018-01-01
      相关资源
      最近更新 更多