This is a newbie C/Objective-C question :-)
Let say I want a CGRectOne and a CGRectTwo constants.
How can I declare that?
Thanks, Jérémy
There are a couple of options. With C89,
const CGRect CGRectOne = { { 0.0f, 0.0f }, { 1.0f, 1.0f } };
With C99,
const CGRect CGRectOne = {
.origin.x = 0.0f,
.origin.y = 0.0f,
.size.width = 1.0f,
.size.height = 1.0f
};
or
const CGRect CGRectOne = {
.origin = { .x = 0.0f, .y = 0.0f },
.size = { .width = 1.0f, .height = 1.0f }
};