我在另一个 xib 类上添加了 xib 作为 subview ,无法从 xib 呈现给 View Controller ( Storyboard Controller )。 我试着跟随
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)
这些都不适合我
提前致谢
最佳答案
这样试试
let screen = UIStoryboard(name: "storyboard name", bundle: nil).instantiateViewController(withIdentifier: "Screen32ViewController") as? Screen32ViewController
self.present(screen!, animated: true, completion: nil)
关于ios - swift3:如何将 xib 呈现给 viewcontroller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41499345/