Comment get la taille du keyboard pour resize UITextView et comment utiliser UIKeyboardFrameEndUserInfoKey avec le keyboard japonais?

Comment get une taille de keyboard pour resize UITextView et comment utiliser UIKeyboardFrameEndUserInfoKey avec le keyboard japonais? Le code suivant pour resize UITextView fonctionne bien sur un keyboard standard. Mais ne fonctionne pas avec le japonais. Comment le réparer?

 - (void)keyboardWillShow:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:YES]; } - (void)keyboardWillHide:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:NO]; } - (void) moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up { NSDictionary* userInfo = [aNotification userInfo]; // Get animation info from userInfo NSTimeInterval animationDuration; UIViewAnimationCurve animationCurve; CGRect keyboardEndFrame; [[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve]; [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration]; [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardEndFrame]; // Animate up or down [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:animationDuration]; [UIView setAnimationCurve:animationCurve]; CGRect newFrame = textView.frame; CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil]; newFrame.size.height -= keyboardFrame.size.height * (up? 1 : -1); textView.frame = newFrame; [UIView commitAnimations]; } 

Merci beaucoup pour l'aide!

Le bon fragment du code:

 CGRect newFrame = editSource.frame; CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil]; keyboardFrame.size.height -= tabBarController.tabBar.frame.size.height; if (up) { editHeight = newFrame.size.height; newFrame.size.height -= keyboardFrame.size.height; } else { newFrame.size.height = editHeight; } editSource.frame = newFrame; 

AVERTISSEMENT!

La méthode est obsolète. La bonne réponse se trouve ici: Comment puis-je append un support pour le keyboard chinois avec UITextView sur iOS 7?