I've created a custom keyboard and used the inputView property to associate it with a UI开发者_如何学运维TextField. When the "dismiss" button on my custom keyboard is pressed, I call resignFirstReponder on my text field.
Before you dismiss this as another IB outlet issue, it's not. The text field pointer is valid, and in fact after calling resignFirstResponder, the caret disappears, which proves that resignFirstResponder is in fact working. It's just that my custom keyboard isn't hiding itself. Any idea why?
Do I need to do anything special on the custom keyboard to make it hide itself?
Try this:
[textField endEditing:YES];
It forces the textField to hide it's keyboard, but I'm not 100% sure it works for custom keyboards too. Give it a try :)!
精彩评论