Swift UINavigationController自定义委托协议

时间:2018-10-20 01:19:34

标签: ios xcode uinavigationcontroller delegates swift-protocols

所以我有一个导航控制器:

class myNavigationController: UINavigationController, UINavigationControllerDelegate
{

    var myVariable : Bool = false

}

我需要这样一个自定义委托才能与其父对话。与其他视图控制器一起使用的常规方法在这里不起作用,因为myNavigationController已经定义了一个委托,即UINavigationControllerDelegate

以下操作无效,但我正在寻找以下内容:

protocol myNavigationControllerDelegate: class
{
    func delegateMethod1()
    func delegateMethod2()
    func delegateMethod3()
}

class myNavigationController: UINavigationController, UINavigationControllerDelegate
{
    weak var delegate   : myNavigationControllerDelegate?
         var myVariable : Bool = false

}

有可能使这项工作可行吗?如果没有,我可以有两名代表吗?第二个自定义对象?

0 个答案:

没有答案