简体   繁体   中英

Drawing outside UIInputViewController frame

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, ie I'm not able to draw some part of pop-up outside of keyboard frame. Ie

在此处输入图片说明

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 ?

文档说这是不可能的: 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM