View动画里面options这个参数怎么用?为什么设置了没有效果?

View动画里面options这个参数怎么用?为什么设置了没有效果?还有= 1 << 4,这些等于 数字 小于小于 数字是什么意思?

<< 是位操作符, 1 << 4 表示 1左移4位 实际值是16

看UIViewAnimationOptions的定义基本就知道怎么用了

typedef NS_OPTI(NSUInteger, UIViewAnimationOptions) {
UIViewAnimationOptionLayoutSubviews            = 1 <<  0,

UIViewAnimationOptionAllowUserInteraction      = 1 <<  1, // turn on user interaction while animating

UIViewAnimationOptionBeginFromCurrentState     = 1 <<  2, // start all views from current value, not initial value

UIViewAnimationOptionRepeat                    = 1 <<  3, // repeat animation indefinitely

UIViewAnimationOptionAutoreverse               = 1 <<  4, // if repeat, run animation back and forth

UIViewAnimationOptionOverrideInheritedDuration = 1 <<  5, // ignore nested duration

UIViewAnimationOptionOverrideInheritedCurve    = 1 <<  6, // ignore nested curve

UIViewAnimationOptionAllowAnimatedContent      = 1 <<  7, // animate contents (applies to transitions only)

UIViewAnimationOptionShowHideTransitionViews   = 1 <<  8, // flip to/from hidden state instead of adding/removing

UIViewAnimationOptionOverrideInheritedOptions  = 1 <<  9, // do not inherit any options or animation type



UIViewAnimationOptionCurveEaseInOut            = 0 << 16, // default

UIViewAnimationOptionCurveEaseIn               = 1 << 16,

UIViewAnimationOptionCurveEaseOut              = 2 << 16,

UIViewAnimationOptionCurveLinear               = 3 << 16,



UIViewAnimationOptionTransitionNone            = 0 << 20, // default

UIViewAnimationOptionTransitionFlipFromLeft    = 1 << 20,

UIViewAnimationOptionTransitionFlipFromRight   = 2 << 20,

UIViewAnimationOptionTransitionCurlUp          = 3 << 20,

UIViewAnimationOptionTransitionCurlDown        = 4 << 20,

UIViewAnimationOptionTransitionCrossDissolve   = 5 << 20,

UIViewAnimationOptionTransitionFlipFromTop     = 6 << 20,

UIViewAnimationOptionTransitionFlipFromBottom  = 7 << 20,

} NS_ENUM_AVAILABLE_IOS(4_0);

<p> </p>
</p>