3
我嘗試使用以下內容,但未能添加新的viewcontrollers視圖。是否只能呈現視圖控制器?我們不能添加其他故事板視圖控制器視圖的視圖嗎?添加新的ViewController的視圖作爲子視圖
//Working
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
self.present(viewcontroller , animated: true, completion: nil)
//Not working
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
vc.view.frame = self.view.frame
self.view.addSubview(vc.view)
你錯過了另一條線 –
或使用vc.willMove(toParentViewController:個體經營) –
@ Anbu.Karthik編輯爲 –