简体   繁体   English

防止UIKeyboard在UISearchBar点击上显示

[英]Prevent UIKeyboard from showing on UISearchBar tap

I have my own custom keyboard in a uiview which i'm adding to the UIWindow in certain situations. 我在uiview中有自己的自定义键盘,在某些情况下会添加到UIWindow中。

I switch between standard UIKeyboard and my custom keyboard with a button. 我使用按钮在标准UIKeyboard和自定义键盘之间切换。

Problem: when i have my custom keyboard already shown on screen and i tap the UISearchBar i get the standard UIkeyboard shown above mine. 问题:当我的自定义键盘已经显示在屏幕上并点击UISearchBar时,我得到了上面显示的标准UIkeyboard。 What I expect is to supress showing of Sandard UIKeyboard when i have my custom one already showing on screen. 我希望在我的自定义界面已经显示在屏幕上时,禁止显示Sandard UIKeyboard。

I intercept keyboardwillshow event but it seems at this event is too late to do that. 我拦截了keyboardwillshow事件,但在此事件看来太晚了。

I also tried subclassing UISearchBar and get control over its UITextField to get the Shouldbegintextediting but it doesn't seem to work ... (FYI UISearchBar doesn't have shouldbegintextediting event in the protocol. Its only for uitextfiled). 我还尝试了对UISearchBar进行子类化,并对其UITextField进行控制以获取Shouldbegintextediting,但它似乎不起作用...(FYI UISearchBar在协议中没有shouldbegintextediting事件。仅适用于uitextfiled)。

Also, there is no such thing as 'inputView' property in UISearchBar. 另外,UISearchBar中没有“ inputView”属性。

I tested this on iOS 5.1. 我在iOS 5.1上进行了测试。

Anyone with experience on this kind of issue? 有人在这种问题上有经验吗?

Thank you. 谢谢。

将搜索字段的inputView设置为自定义键盘。

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

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