swift3:如何将 xib 呈现给 viewcontroller
swift3: How to Present xib to viewcontroller
我在另一个 xib class 上添加了 xib 作为子视图,无法从 xib 呈现给视图控制器(故事板控制器)。
我尝试关注
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)
我在另一个 xib class 上添加了 xib 作为子视图,无法从 xib 呈现给视图控制器(故事板控制器)。 我尝试关注
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)