UITextField
has an inputView
property that can be used to specify a custom keyboard. Clearing this to nil
provides the default keyboard.
If the UITextField
is the first responder, no change occurs on setting inputView
, but by calling [textField reloadInputView]
the keyboard change will happen immediately.
I'd like to be able to switch between two different input approaches. The interface to trigger this will be a UISegmentedView
installed as the UITextField
's inputAccessoryView
.
I've got this working, but the transition is very abrupt. Partly because the spinner and keyboard I transition between have different sizes on the iPad.
I've found that is I wrap an animation block around reloadInputView
, I will get a smooth animation between the two keyboard's view frames. Unfortunately there is a visual judder because the transition is not animated:
[UIView animateWithDuration: 0.3 animations:^()
{
[firstResponder reloadInputViews];
}];
Alternatively, if I wrap the reload in a transition, I can get a nice cross fade, but I don't get smooth frame changes:
[UIView transitionWithView: keyboardWindow
duration: 0.3
options: UIViewAnimationOptionTransitionCrossDissolve
animations: ^(){ [firstResponder reloadInputViews]; }
completion: nil];
(In the second code block I obtained keyboardWindow
from self.window
because this view is installed as the UITextField
's inputAccessoryView
which is ultimately nested under the keyboard's window.)
What I'd like is to animate and transition the input view reload. I tried placing reload in a transition in an animation, and I also tried placing the reload in an animation in a transition – neither seemed to help.
Any ideas? Thanks!