Is there a way to do this type of thing?
static const CGSize maxPageSize = CGSizeMake(460, 651);
This is illegal because "Initializer element is not a compile-time constant."
I could use individual floats, of course, but I'm wondering if there's a way to do this.
Since CGSize
is just a simple C-struct:
struct CGSize {
CGFloat width;
CGFloat height;
};
typedef struct CGSize CGSize;
You can use an initializer list:
static const CGSize maxPageSize = {460, 651};
CGSize
A structure that contains width and height values.
struct CGSize {
CGFloat width;
CGFloat height;
};
typedef struct CGSize CGSize;
Fields width A width value. height A height value.
const CGSize CGSizeZero;
e.g
static const CGSize pageSize = {320, 480};
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