I want to create constants in header file of type CGSize
so I can use this size anywhere in my app just using constantName.height
and constantName.Width
.
I would appreciate if you provide syntax for both cases: 1) fixed height and width, 2) height and width as passing value
Thank you
For fixed height and width
#define MAXSIZE CGSizeMake(320, 480)
For passing values, you can give the value MySizeType i.e defined as CGSize. But for Constant why do you want to pass values.
typedef CGSize MySizeType;
EDIT
After few comments not to use Macros I am elaborating my answer over here.
Using MACROS the drawback is that your debugger cannot know the constant.
And also there more ways to create a constant depends on the scope of your constant you want,
static CGSize const MAXSIZE = {320, 480};
In .h file
extern CGSize const MAXSIZE;
In .m file
CGSize const MAXSIZE = {320,480};