The iOS framework that grows only as fast as its documentation
CGRect Methods

Functions

CGRect NIRectContract (CGRect rect, CGFloat dx, CGFloat dy)
 
CGRect NIRectExpand (CGRect rect, CGFloat dx, CGFloat dy)
 
CGRect NIRectShift (CGRect rect, CGFloat dx, CGFloat dy)
 
CGRect NIEdgeInsetsOutsetRect (CGRect rect, UIEdgeInsets outsets)
 
CGFloat NICenterX (CGSize containerSize, CGSize size)
 
CGFloat NICenterY (CGSize containerSize, CGSize size)
 
CGRect NIFrameOfCenteredViewWithinView (UIView *viewToCenter, UIView *containerView)
 
CGSize NISizeOfStringWithLabelProperties (NSString *string, CGSize constrainedToSize, UIFont *font, NSLineBreakMode lineBreakMode, NSInteger numberOfLines)
 

Overview

For manipulating CGRects.

These methods provide additional means of modifying the edges of CGRects beyond the basics included in CoreGraphics.

Function Documentation

NIRectContract

Modifies only the right and bottom edges of a CGRect.

CGRect NIRectContract;
Discussion
Returns
a CGRect with dx and dy subtracted from the width and height.
 Example result: CGRectMake(x, y, w - dx, h - dy)

NIRectExpand

Modifies only the right and bottom edges of a CGRect.

CGRect NIRectExpand;
Discussion
Returns
a CGRect with dx and dy added to the width and height.
 Example result: CGRectMake(x, y, w + dx, h + dy)

NIRectShift

Modifies only the top and left edges of a CGRect.

CGRect NIRectShift;
Discussion
Returns
a CGRect whose origin has been offset by dx, dy, and whose size has been contracted by dx, dy.

Example result: CGRectMake(x + dx, y + dy, w - dx, h - dy)

NIEdgeInsetsOutsetRect

Inverse of UIEdgeInsetsInsetRect.

CGRect NIEdgeInsetsOutsetRect;
Discussion

Example result: CGRectMake(x - left, y - top, w + left + right, h + top + bottom)

NICenterX

Returns the x position that will center size within containerSize.

CGFloat NICenterX;
Discussion

Example result: floorf((containerSize.width - size.width) / 2.f)

NICenterY

Returns the y position that will center size within containerSize.

CGFloat NICenterY;
Discussion

Example result: floorf((containerSize.height - size.height) / 2.f)

NIFrameOfCenteredViewWithinView

Returns a rect that will center viewToCenter within containerView.

CGRect NIFrameOfCenteredViewWithinView;
Discussion
Returns
a CGPoint that will center viewToCenter within containerView.

NISizeOfStringWithLabelProperties

Returns the size of the string with given UILabel properties.

CGSize NISizeOfStringWithLabelProperties;