Rectangle Utility Functions

As you’ve seen, the CGRectMake() function creates its new rectangle using four parameters: the origin’s x and y locations, the width of the rectangle, and the height. This method is a critical utility for creating frames. You may want to be aware of several other convenience functions, in addition to CGRectMake(), that help you work with rectangles and frames:

Image NSStringFromCGRect(aCGRect) converts a CGRect structure to a formatted string. This function makes it easy to log a view’s frame when you’re debugging.

Image CGRectFromString(aString) ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.