I am doing this to move a ViewController(viewController) to other ViewController(mainMenuViewController) :
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "subView")
addChildViewController(controller)
view.addSubview(controller.view)
controller.view.frame.size.width = 375
controller.view.frame.size.height = 198
controller.didMove(toParentViewController: self)
viewController get moved to mainMenuViewController but problem is that I can't see the the other items like tableView, button I have added to mainMenuViewController
Set frame instead of just height
controller.view.frame = CGRect(x: xPosition, y: y, width: width, height: height)
Also set autoreszingmaskToconstraint to false
controller.view.translatesAutoresizingMaskIntoConstraints = false;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.