Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSView animateWithDuration always takes UIViewAnimationCurveEaseInOut option #77

Open
MaxGraey opened this issue Jan 3, 2012 · 0 comments

Comments

@MaxGraey
Copy link

MaxGraey commented Jan 3, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant