How to get class name of parent ViewController in Swift?

后端 未结 7 2054
清歌不尽
清歌不尽 2021-02-07 03:27

Is there any way to get class name of parent VC in present (child) UIViewController? My \'child\' VC (push) has two \'parent\'UIViewControllers, so I w

7条回答
  •  再見小時候
    2021-02-07 03:56

    try to pick the child from the children array as following

    if let parentVC = self.parent {
    
                if let parentVC = parentVC.children[0] as? someViewController {}}
    

提交回复
热议问题