I'm trying to achieve a similar keyboard interaction that Messages has in iOS 7. I have a UIView
which contains a UITextView
, and when the user selects it to start typing, I want to make this UIView
the inputAccessoryView
. This would take care of the animation for me, as well as the new UIScrollView
keyboard dismiss interaction in iOS 7.
When the UITextView
begins editing, I'm trying to set its inputAccessoryView
to its parent UIView
(which is already in the view hierarchy). The keyboard appears but not with an accessory view.
I've read some people are using a duo of UITextField
s to make this work, but that seems like a bad way to achieve this.
Any suggestions?
A much easier solution is to make your input field the input accessory view of your view controller:
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (UIView *)inputAccessoryView
{
return self.yourInputField;
}
The view will be on screen at the bottom of the screen and when it becomes first responder in response to a user tapping it, the keyboard will be presented. The view will be animated such that it remains immediately above the keyboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With