我已将xib添加到另一个xib类作为子视图,并且无法从xib呈现给视图控制器(Story Board控制器)。 我试过跟着
1
let screen:Screen32ViewController = Screen32ViewController()
self.view.window?.rootViewController?.present(screen!, animated: true, completion: nil)
2
let screen = self.storyboard?.instantiateViewController(withIdentifier: "Screen32ViewController") as? Screen32ViewController
self.present(screen!, animated: true, completion: nil)
3
let screen:Screen32ViewController = Screen32ViewController()
self.present(screen!, animated: true, completion: nil)
这不适用于我
提前致谢
答案 0 :(得分:1)
试试这个
let screen = UIStoryboard(name: "storyboard name", bundle: nil).instantiateViewController(withIdentifier: "Screen32ViewController") as? Screen32ViewController
self.present(screen!, animated: true, completion: nil)