Siva Siva - 4 months ago 58
iOS Question

Can any one please explain what is use of CGRectZero

I am new to iOS. Can any one please explain what the use is of

CGRectZero
and where it is used?

Answer

CFRectZero equals to CGRectMake(0,0,0,0). Usually it's used to fast-initialize CGRect object.

For example:

CGRect frame = CGRectZero;
frame.size.width = someWidth;
frame.size.height = someHeight;
myView.frame = frame;

From Apple's doc:

/* The "zero" rectangle -- equivalent to CGRectMake(0, 0, 0, 0). */ 

CG_EXTERN const CGRect CGRectZero
  CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
Comments