How to display UIView over keyboard in iOS

前端 未结 7 950
醉话见心
醉话见心 2020-12-05 20:04

I want to create a simple view over keyboard, when users tap \"Attach\" button in inputAccessoryView. Something like this:

Is there an easy way to do it? O

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 20:25

    While this can be possible with accessing the topmost window, I would avoid doing this, as it clearly interferes with Apple's guidelines.

    What I would do is dismissing the keyboard and replacing its frame with a view with same dimensions.

    The keyboard's frame can be accessed from keyboard notifications listed here, their userInfo contain a key that can be accessed with UIKeyboardFrameEndUserInfoKey.

提交回复
热议问题