UIKeyboardAnimationCurveUserInfoKey not compatible for block-based UIView animations
| Originator: | yang.meyer | ||
| Number: | rdar://12449780 | Date Originated: | 2012-10-07 |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 7.0 |
| Classification: | Reproducible: | Always |
UIKeyboardAnimationCurveUserInfoKey contains an NSNumber-boxed UIViewAnimationCurve value. This is great for old-style beginAnimations/commitAnimations animations, but makes it easy to introduce bugs when using block-based UIView animations.
This is because UIViewAnimationCurve is not "compatible" with UIViewAnimationOptions.
// Old-style animation – all good:
[UIView beginAnimations:@"UIKeyboard" context:nil];
[UIView setAnimationCurve:[note.userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue]];
self.view.frame = viewFrame;
[UIView commitAnimations];
// Block-based animation – subtle bug:
[UIView animationWithDuration:0.25 delay:0.0
options:[note.userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue] // <-----
animations:^{
self.view.frame = viewFrame;
} completion:nil];
// Block-based animation – correct but feels hacky:
[UIView animationWithDuration:0.25 delay:0.0
options:[note.userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue] << 16 // <-----
animations:^{
self.view.frame = viewFrame;
} completion:nil];
Perhaps introduce a UIKeyboardAnimationOptionCurveUserInfoKey?
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!