由于某些原因,如果我将loadview放入我的VC并将其作为子级添加到另一个vc中,则loadview无效
// MainClass
self.menuVC = SideMenuVC()
self.view.insertSubview(self.menuVC.view, at: 0)
self.addChild(self.menuVC)
self.menuVC.didMove(toParent: self)
public final class SideMenuVC: UIViewController {
// MARK: Initializer
public init() {
super.init(nibName: nil, bundle: nil)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: LifeCycle Methods
public override func loadView() {
super.loadView()
self.view = SideMenuView()
}
public override func viewDidLoad() {
super.viewDidLoad()
}
}
我必须将SideMenuVC包装在UINavigationController内,以便在其中工作loadView。
TIA