UIView Category Adding Simple Frame Changes And Command Chaining
The amount of code required to lay out a view programmatically can be quite extensive if you’re trying to a number of things. There’s also some issues that can arise from playing around with a UIView’s size, and alignment.
iOS View Frame Builder is a UIView category that simplifies the syntax greatly by providing some UIView setting helper methods, and allowing you to chain together different methods to reduce the amount of code while maintaining readability.
iOS View Frame Builder also simplifies the drawing code, and adds a number of methods for resizing and alignment.
Here’s a few examples from the Readme:
Resizing a view:
Moving a view to be centered within it’s superview:
You can combine these methods to your own liking:
You can find iOS View Frame Builder by Podio on Github here.
You’ll find an example included that shows how to use the category with animation blocks.
Original article: UIView Category Adding Simple Frame Changes And Command Chaining
©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.
Source : blancer[dot]com
0 comments:
Post a Comment