enum {
UIViewAnimationOptionLayoutSubviews = 1 << 0,
UIViewAnimationOptionAllowUserInteraction = 1 << 1,
UIViewAnimationOptionBeginFromCurrentState = 1 << 2,
UIViewAnimationOptionRepeat = 1 << 3,
UIViewAnimationOptionAutoreverse = 1 << 4,
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6,
UIViewAnimationOptionAllowAnimatedContent = 1 << 7,
UIViewAnimationOptionShowHideTransitionViews = 1 << 8,
UIViewAnimationOptionCurveEaseInOut = 0 << 16,
UIViewAnimationOptionCurveEaseIn = 1 << 16,
UIViewAnimationOptionCurveEaseOut = 2 << 16,
UIViewAnimationOptionCurveLinear = 3 << 16,
UIViewAnimationOptionTransitionNone = 0 << 20,
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
};
typedef NSUInteger UIViewAnimationOptions;
What exactly means this expression: UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse.
Value of UIViewAnimationOptionRepeat is equal to 8(in bin 1000), UIViewAnimationOptionAutoreverse is equal to 16(in bin 10000). So expression UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse should generate as I think 16(bin 10000) -> UIViewAnimationOptionReverse.
UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverseis known as a “mask”.If you have a variable of type
UIViewAnimationOptions, say:you can apply the mask to it like this:
to determine if
a“contains” either flags. Ifthen
if
then
So you are not actually interested in what
UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverseevaluates to, but only in the result of logically and-ing a value of that type to the flags you are interested in checking.