iOS 8 move o UIView para cima quando o teclado aparece | Questão
eu tenho umUIView
com umUITextField
colocado na parte inferior da tela, que se moverá para cima quando um teclado aparecer.
Eu tenho seguido o método abaixo antes do iOS 8 e parece funcionar perfeitamente.
// When Keyboard appears
- (void)keyboardWillShow:(NSNotification *)notification {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]];
[UIView setAnimationCurve:[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey]integerValue]];
[UIView setAnimationBeginsFromCurrentState:YES];
// Frame Update
CGRect frame = self.bottomView.frame;
frame.origin.y = self.view.frame.size.height - 266.0f;
self.bottomView.frame = frame;
[UIView commitAnimations];
}
// When keyboard disappears
- (void) keyboardHides : (NSNotification *) notification {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]];
[UIView setAnimationCurve:[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]];
[UIView setAnimationBeginsFromCurrentState:YES];
// Frame update
CGRect frame = self.bottomView.frame;
frame.origin.y = self.view.frame.size.height - self.bottomView.frame.size.height;
self.bottomView.frame = frame;
[UIView commitAnimations];
}
Mas o código acima parece não funcionar emiOS 8
enquanto o teclado bloqueia o UIView atrás dele.
Depois de um pouco de pesquisa, descobri umquase semelhante responda. Mas aqui o todoUIView
estava sendo empurrado para cima, e o que eu gostaria de alcançar era apenas mover obottom UIView
.