I am using the parent view controller and the child view controller in my application. In which the parent view controller contains a subview as a button with a value of zPosition 2.
Now I add the controller of the child view to the parent, as shown below,
func addChildViewController(){
let storyboard = UIStoryboard(name: "myStoryBoard", bundle: nil)
let childVC = storyboard.instantiateViewController(withIdentifier: "childVC") as! ChildViewController
addChildViewController(childVC)
self.view.addSubview(childVC.view)
childVC.didMove(toParentViewController: self)
}
Button mobility is visible at the top of the child view controller, but the click event does not fire.
Note . I do not add a button as a subview in the controller of the child view only in the parent view.
source
share