CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

FMFrameMaker 0.3

FMFrameMaker 0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jan 2015

Maintained by Andy LaVoy.



  • By
  • Andy LaVoy

FMFrameMaker is an Objective-C library for simplifying, encapsulating, and optimizing view layout logic into a single block for each view.

CGRect frames are based upon the top left corner (origin) and the width and height (size). If you want to layout from the right, you have to do math. If you want to center, you have to do math. If you want to inset from the edges, you have to do math. With FrameMaker, you can forget about the math. You just specify the pieces you want to anchor, and FrameMaker figures out the rest.

  • Layout a view using its right or (gasp) bottom edges
  • Set edge insets for a view and let it size automatically
  • Center vertically and/or horizontally with no math
  • A single call to -setFrame: to minimize laying out the view hierarchy

This library was inspired by Masonry, but without the AutoLayout.

A Few Examples

#import "FMFrameMaker.h"

Center a sized view

[view fm_makeFrame:^(FMFrameMaker *frameMaker) {
    frameMaker.size = CGSizeMake(100, 100);
    frameMaker.centered = YES;
}];

Show a sized view 10 points from the bottom right corner

[view fm_makeFrame:^(FMFrameMaker *frameMaker) {
    frameMaker.size = CGSizeMake(100, 100);
    frameMaker.bottom = 10;
    frameMaker.right = 10;
}];

Show a view sized inset 20 points vertically and horizontally

[view fm_makeFrame:^(FMFrameMaker *frameMaker) {
    frameMaker.size = CGSizeMake(100, 100);
    frameMaker.horizontalOffset = 20;
    frameMaker.verticalOffset = 20;
}];

Check out the demo project for more examples.

Requirements

FrameMaker uses simple APIs and is compatible all the way back to iOS 2.0.

ARC

Yuuuup!

Creator

Andy LaVoy
@lavoy

License

FrameMaker is available under the MIT license.