I'm new to iPhone design, and I'm just trying to follow some simple drawing procedures, and I'm having problems using certain values ββin simple math.
I have a line like this:
int offset = (((myValue - min_value) * 6) - middle);
and it works fine, but I don't like to use hard-coded 6 there (because I will use it a lot of places.
So, I thought I would define a constant using #define:
#define WIDTH_OFFSET 6;
then I could use:
int offset = (((myValue - min_value) * WIDTH_OFFSET) - middle);
however - this gets a compiler error: "Expected Expression".
I can get around this by breaking the calculations into several lines:
int offset = myValue - min_value; offset = offset * WIDTH_OFFSET; offset = offset - middle;
The compiler thinks this is normal.
I assume that there is some implicit catchy or some other function of the language here - can someone explain to me what is happening?
source share