我的 iPad 应用程序有一个弹出窗口,上半部分有几个
UITextField
。
当点击文本字段(使键盘出现)时,iOS 会缩放(并移动)我的弹出框。我不想那样。
如何防止 iOS 这样做?
这个答案建议重写一些
keyboardWillShow()
和 keyboardWillHide()
函数,但不清楚它们是在哪里定义的。
正如 Leszek 在评论中提到的,更新
popoverPresentationController.popoverLayoutMargins
的 UIViewController
以适应键盘的高度:
func configurePopoverPresentationController() {
let keyboardHeight = 500
popoverPresentationController.popoverLayoutMargins = UIEdgeInsets(top: 0.0, left: 0.0, bottom: -keyboardHeight, right: 0.0)
}