GetFirstResponder without hiding the keyboard

I have a view that supports copying and shows an edit menu using the following code:

if ([self becomeFirstResponder]) { // bring up edit menu. UIMenuController *theMenu = [UIMenuController sharedMenuController]; [theMenu setTargetRect:[self _textRect] inView:self]; [theMenu setMenuVisible:YES animated:YES]; } 

The problem is that when calling getFirstResponder, the keyboard is hidden. A good example of proper behavior is the SMS application. Double-tap the message until the response field is visible and the response field loses focus, but the keyboard remains in place. In addition, when the bubble cancels, the response window restores focus.

+6
ios iphone ipad first-responder
source share
1 answer

Unfortunately, Apple can do many things inaccessible to third-party applications.

I believe that you want, possibly in iOS 3.2+, if you make a presentation that should be the first responder to accept keyboard input. You do this if your view class accepts the UIKeyInput protocol :

A subclass of UIResponder can adopt this protocol to implement simple text writing. When instances of this subclass are the first responder, the system keyboard is displayed.

The protocol consists of 3 necessary methods that you must implement. In your case, you will probably apply the data you enter in these methods to your text field and again make it the first responder. I have not tried this, but it should work.

+5
source share

All Articles