BigZaphod/Chameleon — Issue #77: NSView animateWithDuration always takes UIViewAnimationCurveEaseInOut option
Author: MaxGraey
Created: 2012-01-03 19:46:59+00:00
State: open

In the example presented below:

UIView animateWithDuration:1.5 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^(void) {
// property animations
} completion:nil ];

the argument "options" always takes the same value (UIViewAnimationCurveEaseInOut) regardless of actual value.
The fact that the implementation of that method lies the error. In this situation you can not work with enums as with bit-fields!

If we replace this:

// In UIView
// + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay
// options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion

if ((options & UIViewAnimationOptionCurveEaseInOut) == UIViewAnimationOptionCurveEaseInOut) {
animationCurve = UIViewAnimationCurveEaseInOut;
} else if ((options & UIViewAnimationOptionCurveEaseIn) == UIViewAnimationOptionCurveEaseIn) {
animationCurve = UIViewAnimationCurveEaseIn;
} else if ((options & UIViewAnimationOptionCurveEaseOut) == UIViewAnimationOptionCurveEaseOut) {
animationCurve = UIViewAnimationCurveEaseOut;
} else {
animationCurve = UIViewAnimationCurveLinear;
}

On simple:

animationCurve = (options >> 16) & 0x03;

Then the behavior will be correct