I have an instance of UIToolbar that contains a UITextField inside. I’d like to set the toolbar at an accessory view for the UITextField it contains.
The way I do this is as follows:
[myTextView setInputAccessoryView:myToolbar];
When I compile and run the code, the entire keyboard disappears when I press on the text field. I specifically made sure I am setting the inputAccessoryView and not the inputView. It seems like the whole input view just got replaced, without any explicit direction to do so.
Does anyone know a way to fix this?
It’s generally not good to put a text field in an input accessory view… What would be better is if you put the toolbar along the bottom of your view and then use
UIKeyboardWillChangeFrameNotificationto move the toolbar with the keyboard…In your viewDidLoad:
And somewhere in your view controller’s code: