简体   繁体   English

在UIInputViewController框架外绘制

[英]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; 我尝试过的事情:我尝试设置属性view.layer.masksToBounds = NO; of UIInputViewController instance, but still I got my extension masked. UIInputViewController实例的实例,但我的扩展名仍然被屏蔽。 The official docs are yet not quite descriptive on this issue. 官方文档尚未对此问题进行描述。 Although this might be one of the iOS keyboard extension limitations. 尽管这可能是iOS键盘扩展名的限制之一。

Any suggestions, references are welcomed on how to draw outside UIInputViewController frame ? 任何建议,欢迎参考如何在UIInputViewController框架外部UIInputViewController

文档说这是不可能的: 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. 如果您在viewDidAppear()中更改了键盘的高度该怎么办,则UIInputViewController将得到扩展,并且您将能够在第一行上方进行绘制。

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 ). 要扩展它,请检查Cris答案以获取Obj-C代码或Satoshi的答案以获取快速代码...( 无法更改UIInputView height )。

Good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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