Sorry if this is a common question but I don't know what it's called so I'm having trouble searching for it.
How does this work:
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
I understand that it means that the view gets both flexible width and height, but how does it store two variables like that?
If i look at the typedef for UIViewAutoresizing it looks like:
enum {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
UIViewAutoresizingFlexibleWidth = 1 << 1,
...
So, how can one variable store more than one value like this?
"|" is a bitwise 'or'.
"<<" is also a bitwise operation shifting. it moves all the bits to the left:
00100 << 1 = 01000
Read the wiki, you're interested in "or" and shift operations.
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