Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

StevenHu

macrumors member
Original poster
Sep 3, 2009
80
0
Southern CA
In Apple's UICatalog, some segmented controls' y distance is set at "yPlacement += 30;"

If I set it at "yPlacement = 30;" it moves up around 10 pixels from current position (so it's 20 pixels from the top of the window).
If I set it at "yPlacement + 30;" it moves up around 30 pixels (so it's 30 pixels from the top of the window).

Can anyone help me understand this?

Thanks,
Steve
 
+= is the C assignment by addition operator. It takes whatever is in the variable on the left side, adds whatever value is on the right side, and stores the result back into the variable on the left.

Code:
int x = 30;
x += 3;
After the second line, x will contain 33.

Wikipedia has a reference for all the C operators: http://en.wikipedia.org/wiki/Operators_in_C_and_C++
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.