let secondVC = SecondViewController(nibName: "SecondViewController", bundle: nil)
var cgRectFrame = secondVC.view.frame
cgRectFrame.origin = CGPoint(x: self.view.frame.origin.x, y:self.view.frame.origin.y+64)
cgRectFrame.size = CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height)
secondVC.view.frame = cgRectFrame
IBMainView.addSubview(secondVC.view)
答案 0 :(得分:0)
尝试secondVC.view.isUserInteractionEnabled = true
答案 1 :(得分:0)
在代码中添加“self.addChildViewController(viewController_object)”
let secondVC = SecondViewController(nibName: "SecondViewController", bundle: nil)
self.addChildViewController(secondVC)
var cgRectFrame = secondVC.view.frame
cgRectFrame.origin = CGPoint(x: self.view.frame.origin.x, y:self.view.frame.origin.y+64)
cgRectFrame.size = CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height)
secondVC.view.frame = cgRectFrame
IBMainView.addSubview(secondVC.view)