Drawing outside UIInputViewController frame

淺唱寂寞╮ 提交于 2019-12-06 03:10:26

问题


Intro: I'm developing a keyboard extension for my native Armenian language.

The keyboard's features should look like maximum similar to system default keyboard.

One of the features I want to have inside my keyboard is to display Pop-ups on top of the touched buttons, like it is for English keyboard

As you can see the pop-up can be drawn outside the keyboard frame

Problem: I've managed to draw successfully the pop-up inside the frame of keyboard, but it gets masked to the keyboard frame, i.e. I'm not able to draw some part of pop-up outside of keyboard frame. I.e.

What I tried: I tried the to set the property view.layer.masksToBounds = NO; of UIInputViewController instance, but still I got my extension masked. The official docs are yet not quite descriptive on this issue. Although this might be one of the iOS keyboard extension limitations.

Any suggestions, references are welcomed on how to draw outside UIInputViewController frame ?


回答1:


The documentation says that this is not possible: In addition, it is not possible to display key artwork above the top row, as the system keyboard does on iPhone when you tap a key in the top row.




回答2:


What if you changed the height of the keyboard in the viewDidAppear() then the UIInputViewController will get expanded and you will be able to draw above the top row.

This trick used for adding a word prediction area but in your case I think its your only perfect solution ...

To expand it check Cris answer for Obj-C code or Satoshi's answer for swift code ... (Unable to change UIInputView height).

Good luck



来源:https://stackoverflow.com/questions/24969737/drawing-outside-uiinputviewcontroller-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!