I'm trying to embed a custom view in UIViewController. But when displayed, it's not clickable since it's out of the UIView frame.
viewDidLoad:
@IBOutlet var theVC_InVC_Test: UIView!
@IBOutlet var TableView: UITableView!
override func viewDidLoad() {
TableView.delegate = self
TableView.dataSource = self
func embed(_ viewController:UIViewController, inView view:UIView){
viewController.willMove(toParent: self)
viewController.view.frame = view.bounds
view.addSubview(viewController.view)
self.addChild(viewController)
viewController.didMove(toParent: self)
}
embed(sidemenutest1(), inView: theVC_InVC_Test)
}
sidemenutest1 UIViewController:
func popItOver(){
let PopOverVC = UIStoryboard(name:"Main",bundle: nil).instantiateViewController(withIdentifier: "CoinsPopUp") as! CoinsPopUpViewController
self.addChild(PopOverVC)
PopOverVC.view.frame = UIScreen.main.bounds
self.view.addSubview(PopOverVC.view)
PopOverVC.didMove(toParent: self)
}
@IBAction func storeAction(_ sender: Any) {
popItOver()
}
It's displayed fine, but it's not clickable... When I tried to click the subview buttons, the TableView is clicked and not the subview.