Keyboard auto correction height (with / without auto correction)

I am getting the keyboard height like this:

- (void)keyboardNotification:(NSNotification*)notification
{
    NSDictionary* keyboardInfo = [notification userInfo];
    NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey];
    CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue];
}

      

Now I have the keyboard height. But without auto-correction height:

enter image description here

If the value UITextAutocorrectionType

is YES

/ NO

, the keyboard height remains unchanged.

How do I get the keyboard autocorrection height?

Thanks in advance.

+3


source to share


2 answers


Use this:



 CGRect keyboardBounds;
        [[notification.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
   // Need to translate the bounds to account for rotation.
  keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];

      

+1


source


Use UIKeyboardWillChangeFrameNotification

. This will be called every time the tooltip bar is shown or hidden.



NSConcreteNotification 0xc472900 {name = UIKeyboardWillChangeFrameNotification; userInfo = {
    UIKeyboardAnimationCurveUserInfoKey = 7;
    UIKeyboardAnimationDurationUserInfoKey = "0.25";
    UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 216}}";
    UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 588}";
    UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 372}";
    UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 480}, {320, 216}}";
    UIKeyboardFrameChangedByUserInteraction = 0;
    UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 264}, {320, 216}}";
}}

      

0


source







All Articles