How dismiss keyboard without losing focus. or at least show cursor
How dismiss keyboard without losing focus. or at least show cursor.
I have speech recognition button and textview. User can type with keyboard or use speech recognition. But I want to dismiss keyboard while user using speech recognition.
Currently, I am resigning responder but it hides cursor on textView.
I solved these with following steps:
1) I subclassed UIWindow
and override sendEvent
Inside: I check for tap presence and do following if view is intended one
UITextView *view=(UITextView*)touch.view;
view.input=nil;
[view reloadInputViews];
This way I ensure that on tap Keyboard will appear for my textview
2) For my speech recognition button click I do following to hide default keyboard
myview.input=[[UIView alloc]init];
[myview reloadInputViews];
链接地址: http://www.djcxy.com/p/44230.html