What is the difference between 0 << 16 and 0 << 20? I found it in UIViewAnimationOptions.
There isn't. They are both 0
UIViewAnimationOptionTransitionNone = 0 << 20,
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
UIViewAnimationOptionTransitionCrossDissolve = 5 << 20,
UIViewAnimationOptionTransitionFlipFromTop = 6 << 20,
UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20,
The UIViewAnimationOptionTransition settings are all concerned with setting the bits 20-23. UIViewAnimationOptionTransitionNone is zero, however, it is defined in the same manner as the other UIViewAnimationTransitions for consistency.
Both of the given values are zero which indicates they are both the default settings, if you don't pass transition flag you'll get no transition by default. But you can also specify that explicitly.
0 << 16
is shifting left 16 bits, 0 << 20
shifting 20 bits. Both end up being 0.
I'm guessing it's being done for clarity, just like sizeof(char) is sometimes used in malloc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With