ios 当键盘出现时,如何防止弹出框缩放?

ruarlubt  于 9个月前  发布在  iOS
关注(0)|答案(1)|浏览(117)

我的iPad应用程序在上半部分有一个弹出框,上面有几个UITextField
当点击文本字段时,会出现键盘,iOS会缩放(和移动)我的弹出框。我不想这样。
如何防止iOS这样做?
This answer建议覆盖一些keyboardWillShow()keyboardWillHide()函数,但不清楚这些函数是在哪里定义的。

ibrsph3r

ibrsph3r1#

正如Leszek在评论中提到的,更新UIViewControllerpopoverPresentationController.popoverLayoutMargins以适应键盘的高度:

func configurePopoverPresentationController() {
        let keyboardHeight = 500
        popoverPresentationController.popoverLayoutMargins = UIEdgeInsets(top: 0.0, left: 0.0, bottom: -keyboardHeight, right: 0.0)
    }

字符串

相关问题