Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift NavigationController推送方法请求不存在';无法从弹出视图工作 将显示新的弹出窗口ViewController。overCurrentContext 有两个按钮,用于从弹出视图中导航其他两个视图_Swift_Popup_Segue - Fatal编程技术网

Swift NavigationController推送方法请求不存在';无法从弹出视图工作 将显示新的弹出窗口ViewController。overCurrentContext 有两个按钮,用于从弹出视图中导航其他两个视图

Swift NavigationController推送方法请求不存在';无法从弹出视图工作 将显示新的弹出窗口ViewController。overCurrentContext 有两个按钮,用于从弹出视图中导航其他两个视图,swift,popup,segue,Swift,Popup,Segue,一个简单的操作,比如print,进行得很顺利,但是当我尝试以编程方式(从xib文件,popUpViewController)进行分割时,什么也没有发生 let vc = RegisterEmailViewController.instantiate() vc.coordinator = self navigationController.pushViewController(vc, animated: false) 从任何其他角度来看都很好。 有什么不对劲吗 PopUpViewControl

一个简单的操作,比如
print
,进行得很顺利,但是当我尝试以编程方式(从
xib
文件,
popUpViewController
)进行分割时,什么也没有发生

let vc = RegisterEmailViewController.instantiate()
vc.coordinator = self
navigationController.pushViewController(vc, animated: false)
从任何其他角度来看都很好。 有什么不对劲吗

PopUpViewController代码:

//  Created by ᴀʟᴇxᴀɴᴅʀ ᴢʜᴇʟɪᴇᴢɴɪᴀᴋ on 23.12.2019.
//  Copyright © 2019 ᴀʟᴇxᴀɴᴅʀ ᴢʜᴇʟɪᴇᴢɴɪᴀᴋ. All rights reserved.

import UIKit

class ViewController: UIViewController, Storyboarded {
    weak var coordinator: MyCoordinator?

    @IBAction func dismissPopUp(_ sender: Any) {
        dismiss(animated: false, completion: nil)
    }

    @IBAction func buttonEmail(_ sender: Any) {
        let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "EmailViewController") as? EmailViewController
        self.navigationController?.pushViewController(vc!, animated: true)
    }

    @IBAction func buttonPhone(_ sender: Any) {
        let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "PhoneViewController") as? PhoneViewController
        self.navigationController?.pushViewController(vc!, animated: true)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }

}

有一个
myocordinator
,它初始化所有导航,不允许我自己简单地进行分类/导航

var childCoordinators = [Coordinator]()
var navigationController: UINavigationController

init(navigationController: UINavigationController) {
    self.navigationController = navigationController
}
因此,参考控制器解决了该问题。可以在一旁导航,直到调用新的子视图和单独的视图

在此情况下起作用的代码:

    let vc = RegisterEmailViewController.instantiate()
    vc.coordinator = self
    navigationController.pushViewController(vc, animated: false)
结语。简单来说,有两种方法:

  • 删除所有依赖项和使用
    UINavigationController
  • 仅通过新方法声明以供全局使用

  • 您的弹出窗口
    ViewController
    是否嵌入了
    UINavigationController
    ?当您尝试推送新的vc时,console是否会给您任何警告?@vpoltave是的,它嵌入了UINavigationController?协调员办公室。没有警告,没有错误。没有什么。它似乎没有在弹出视图之外调用方法/视图。您可以添加更多与问题相关的代码来创建导航和弹出vc吗?
    navigationController
    UIViewController
    navigationController.pushViewController(vc,动画:false)的可选属性
    这甚至不应该编译。你能在你的
    iAction
    中打印它的值吗?以及你如何呈现这个初始的
    ViewController
    ?如果可能,请添加代码