gpt4 book ai didi

ios - swift3:如何将 xib 呈现给 viewcontroller

转载 作者:行者123 更新时间:2023-11-29 11:50:05 25 4
gpt4 key购买 nike

我在另一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com