I am new to iOS. Can any one please explain what the use is of CGRectZero
and where it is used?
A rectangle constant with location (0,0) , and width and height of 0. The zero rectangle is equivalent to CGRectMake(0,0,0,0) .
Overview. A CGSize structure is sometimes used to represent a distance vector, rather than a physical size. As a vector, its values can be negative. To normalize a CGRect structure so that its size is represented by positive values, call the CGRectStandardize(_:) function.
A structure that contains the location and dimensions of a rectangle.
CGRectZero 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);
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