Reputation: 14894
CGRectEdge is defined in CGGeometry.h like so:
enum CGRectEdge {
CGRectMinXEdge, CGRectMinYEdge, CGRectMaxXEdge, CGRectMaxYEdge
};
typedef enum CGRectEdge CGRectEdge;
and the documentation (in CGGeometry Reference) says that CGRectEdge is "coordinates that establish the edges of a rectangle". So what is setting these values? Or how can these values be set? The individual values are read-only. It sounds potentially useful but I don't see how to use it for anything since I don't see how to set it. Nor how to relate it to a particular rectangle.
Upvotes: 3
Views: 878
Reputation: 2459
The CGRectEdge enum is used to supply information to calls that divide rectangles into sub-rectangles, these two calls being CGRectDivide in <CoreGraphics/CGGeometry.h> and MKMapRectDivide in <MapKit/MKGeometry.h>.
/* Make two new rectangles, `slice' and `remainder', by dividing `rect' with
a line that's parallel to one of its sides, specified by `edge' -- either
`CGRectMinXEdge', `CGRectMinYEdge', `CGRectMaxXEdge', or
`CGRectMaxYEdge'. The size of `slice' is determined by `amount', which
measures the distance from the specified edge. */
void CGRectDivide(CGRect rect, CGRect *slice, CGRect *remainder,
CGFloat amount, CGRectEdge edge);
void MKMapRectDivide(MKMapRect rect, MKMapRect *slice, MKMapRect *remainder, double amount, CGRectEdge edge) NS_AVAILABLE(10_9, 4_0);
Upvotes: 3
Reputation: 2882
This is primarily used in CGRectDivide from what I can tell.
You would pass a type of CGRectEdge
to the parameter edge
An edge value that specifies the side of the rectangle from which the distance passed in the amount parameter is measured. CGRectDivide produces a “slice” rectangle that contains the specified edge and extends amount distance beyond it.
Upvotes: 3