Summary (For tho who want the tl;dr version, you may skip to the question below):
I've just gone through this problem: Comparing UIDeviceOrienation and UIInterfaceOrientation. After that, I took a look at how bitwise work (because I've seen them sometimes, but not really understand how they work.)
So, I've taken a research about What's bitwise operator, How enum in objective-c work with bit, How to use enum that's in bit.
(TL;DR) Now, here's my question:
Let's say, I want to check if my UIInterfaceOrientation = Landscape (Left | Right) should I use it like this:
[UIApplication sharedApplication].statusBarOrientation ==
(UIInterfaceOrientationLandscapeLeft |
UIInterfaceOrientationLandscapeRight)
OR
[UIApplication sharedApplication].statusBarOrientation &
(UIInterfaceOrientationLandscapeLeft |
UIInterfaceOrientationLandscapeRight)
Should they give the same result? Or different? Which one is more appropriate?
(In my simple mind, if it's not wrong then the second one is more appropriate).
BONUS QUESTION
Other than enums, is there anywhere else where I can use bitwise, bitshift operator effectively?