[英]iOS UIInputViewController: present Custom UIViewController + NIB
I've a keyboard extension and want to present a custom UIViewController with a NIB file inside an UIInputViewController. 我有一个键盘扩展,想要在UIInputViewController内提供带有NIB文件的自定义UIViewController。 I already made some custom keyboards with ObjectiveC in the past. 过去,我已经使用ObjectiveC制作了一些自定义键盘。 There I could set a UiNavigationController to the UIInputViewController. 在那里,我可以将UiNavigationController设置为UIInputViewController。 But it seems that this is not possible anymore. 但这似乎不再可行。
Here is some sample code that doesn't work. 这是一些无效的示例代码。
class KeyboardViewController: UIInputViewController {
override func viewDidLoad() {
super.viewDidLoad()
let controller: MyViewController = MyViewController()
self.present(controller, animated: false, completion: nil)
}
...
}
I have solved my problem: 我已经解决了我的问题:
I just put the code into viewDidAppear
instead of viewDidLoad
我只是将代码放入viewDidAppear
而不是viewDidLoad
override func viewDidAppear(_ animated: Bool) {
let controller: MyViewController = MyViewController()
self.present(controller, animated: false, completion: nil)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.