UIKeyboardWillChangeFrameNotification UIViewAnimationCurve set to 7 on iOS 7

I am looking to determine how the keyboard will be displayed. On iOS 6, I get a valid value for UIKeyboardAnimationCurveUserInfoKey (which should be UIViewAnimationCurve with a value from 0-3), but the function returns 7. How does the keyboard activate? What can be done with a value of 7?

 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}}"; }} 
+6
source share
2 answers

The keyboard seems to use an undocumented / unknown animation curve.

But you can still use it. To convert it to UIViewAnimationOptions to animate the block, move it 16 bits so:

 UIViewAnimationCurve keyboardTransitionAnimationCurve; [[notification.userInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&keyboardTransitionAnimationCurve]; keyboardTransitionAnimationCurve |= keyboardTransitionAnimationCurve<<16; [UIView animateWithDuration:0.5 delay:0.0 options:keyboardTransitionAnimationCurve animations:^{ // ... do stuff here } completion:NULL]; 

Or just pass it as an animation curve.

 UIViewAnimationCurve keyboardTransitionAnimationCurve; [[notification.userInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&keyboardTransitionAnimationCurve]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationCurve:keyboardTransitionAnimationCurve]; // ... do stuff here [UIView commitAnimations]; 
+18
source

I can not comment, unfortunately, otherwise I would instead introduce a new answer.

You can also use:

animationOptions | = animationCurve <<16;

This may be preferable since it will preserve previous OR = operations for animation.

+1
source

Source: https://habr.com/ru/post/956368/


All Articles