如何使自定义键盘扩展成为第一响应者 [英] How to make custom keyboard extension become first responder again

查看:127
本文介绍了如何使自定义键盘扩展成为第一响应者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个自定义键盘扩展,在这个键盘中,我有另一个uitextfield作为搜索字段,所以当我在自定义键盘上输入时,我不会将文本发送到safari的文本字段或某个聊天应用程序的文本字段,我将文本发送到自定义键盘中的uitextfield搜索字段,因此我可以进行一些搜索,然后当搜索结果返回时,我将搜索结果发送到safari的文本字段或某个聊天应用程序的文本字段。所以这里有一个第一响应者问题。当我将搜索文本字段设置为第一响应者时,并尝试将第一个响应者设置回safari的文本字段。它不再起作用了。问题是如何将make safari再次设置为第一响应者?在它的第一个响应者通过搜索字段采取后。

解决方案

iOS是何时显示键盘的唯一决定因素,不管是系统键盘或自定义键盘(现在它们是相同的)。



您可以将UI元素添加到自定义键盘,但无法决定何时显示键盘。 / p>

Apple在很长一段时间内允许使用第三方键盘,作为用户,我不希望在没有我请求的情况下弹出键盘。


I am making a custom keyboard extension, and in this keyboard, i have another uitextfield as a search field, so when I type on the custom keyboard, I am not sending the text to the safari's textfield or some chat app's textfield, I am sending the text to the uitextfield search field in the custom keyboard, so I can do some search and then when the search results come back, i am sending the search result to the safari's textfield or some chat app's textfield. So there is a first responder issue here. When I set the search text field as first responder, and trying to set the first responder back to the safari's textfield. It's not working any more. The question is how to set the make safari's as first responder again? after it's first responder been taking by search field.

解决方案

iOS is the sole decider on when to display a keyboard, be it a system keyboard or a custom keyboard (they are the same now).

You can add UI elements to your custom keyboard, but you cannot decide when to display the keyboard.

Apple went a long way allowing 3rd party keyboards, and as a user, I wouldn't want a keyboard popping-up without me requesting it.

这篇关于如何使自定义键盘扩展成为第一响应者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆