我正在展示这样的自定义 WebView 。
let vc = CustomWebViewVC.viewController()
vc.delegate = self
present(vc, animated: true, completion: nil)
我已经实现了它以在横向模式下显示自定义 WebView 。
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return .landscapeRight
}
//----------------------------------------------------------
override var shouldAutorotate: Bool {
return false
}
问题
CustomWebViewVC 在横向模式下正确打开,但是当我点击 webivew 内的文本字段时会发生这种情况。
我不知道是什么问题。
有什么建议吗?
最佳答案
缺少的方法是这个
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.landscapeRight
}
在 View Controller 中添加这个之后就成功了。
要在横向模式下打开 viewcontroller,您需要像我一样实现所有三个方法。
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return .landscapeRight
}
//----------------------------------------------------------
override var shouldAutorotate: Bool {
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.landscapeRight
}
关于ios - 键盘在 Web View 中未正确显示 - 横向模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55038297/