how to pass data from UIPageViewController to child ViewController using delegates

后端 未结 2 1380
庸人自扰
庸人自扰 2020-12-22 13:00

I want to pass data from a UIPageViewController to one of its child ViewControllers. I have a protocol set like so:

protocol Delega         


        
2条回答
  •  一个人的身影
    2020-12-22 13:31

    The problem is this line:

        let pvc = PageVC()
    

    That makes a new, separate PageVC. That's not what you want. You want a reference to the existing, actual PageVC whose parent this is. That reference is self.parent (though not, perhaps, in viewDidLoad, which is rather early and might not guarantee that we are the child yet).

提交回复
热议问题