Swift can't call protocol method via delegate

后端 未结 2 734
清歌不尽
清歌不尽 2021-01-16 08:43

I have two classes. One class is named ViewController and the other class is named TabView.

My goal is to call a function changeTab()

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 09:20

    you are creating a new instance in this line:

    let myVC = ViewController()
    

    you should get existing instance of your ViewController.then set

    myVC.delegateCustom = self
    

提交回复
热议问题