In iOS 6 I'm used to present keyboard in viewDidLoad
.
- (void)viewDidLoad
{
[super viewDidLoad];
[txtField becomeFirstResponder];
}
This way, when navigationController pushes the new viewController, keyboard is already there, animating smoothly from left to right and avoiding bottom-up animation.
In iOS 7 this behavior seems broken.
If I add [txtField becomeFirstResponder]
in viewDidLoad
, keyboard appears in the middle of pushing animation, already in its final position: an unpleasant effect!!
I've tried to move [txtField becomeFirstResponder]
in viewWillAppear
, but the final result is unchanged.
Do you know a way to get back iOS 6 behavior, pushing the new viewController and the keyboard all together?
EDIT: Using a timer doesn't work either... whatever time delay I set, the keyboard is shown only at the end of pushing animation.
So far, my best try it is to put [txtField becomeFirstResponder]
in viewWillLayoutSubviews
or viewDidLayoutSubviews
. Unfortunately, doing so working when pushing viewController but not when popping back (the keyboard doesn't appear).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…