Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resignFirstResponder() in Third-Party Keyboards

I have a third party keyboard that currently contains a UISearchBar(that is first responder on start) and the user is able to search for content (i.e. gifs) to be able to copy, paste, send to friends, etc.

In theory, after entering text in the bar and pressing search, the user should be able to enter text in the application's actual UITextView (i.e. the message field in the messages app) but for some reason this doesn't work and although typing works, nothing actually appears. I have tried searchBar.resignFirstResponder(), self.becomeFirstResponder() and many combinations of .endEditing(true) to no avail. I know it is possible to do this as apps like Giffy do it but I can't figure it out for the life of me. Any help would be greatly appreciated.

like image 215
cyril Avatar asked Oct 26 '15 14:10

cyril


People also ask

What is the default response for resigning first responder?

The default implementation returns true, resigning first responder status. You can override this method in your custom responders to update your object's state or perform other actions, such as removing the highlight from a selection. You can also return false, refusing to relinquish first responder status.

Are third party keyboards blocked in iOS for personal accounts?

Updated - Known issue: Third party keyboards are not blocked in iOS for personal accounts Back to Blog Newer Article Older Article Updated - Known issue: Third party keyboards are not blocked in iOS for personal accounts

How do I override the first responder method in custom responders?

You can override this method in your custom responders to update your object's state or perform other actions, such as removing the highlight from a selection. You can also return false, refusing to relinquish first responder status. If you override this method, you must call super (the superclass implementation) at some point in your code.

Can you return a false first responder status?

You can also return false, refusing to relinquish first responder status. If you override this method, you must call super (the superclass implementation) at some point in your code.


1 Answers

Keyboard extensions with built-in search bars usually implement their search bar as a UILabel, adding custom text handling behavior that modifies the text property of the label based on user input.

like image 65
Ben Pious Avatar answered Sep 25 '22 17:09

Ben Pious