Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get keyboard size to resize UITextView and how to use UIKeyboardFrameEndUserInfoKey with Japanese keyboard?
    text
    copied!<p>How to get a keyboard size to resize <code>UITextView</code> and how to use <code>UIKeyboardFrameEndUserInfoKey</code> with Japanese keyboard? The following code to resize <code>UITextView</code> works good on a standard keyboard. But doesn't work with Japanese. How to fix it?</p> <pre><code>- (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:&amp;animationCurve]; [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&amp;animationDuration]; [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&amp;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]; } </code></pre> <p>Thanks a lot for the help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload