Get Updates By E-mail 

Article Written By:
Johann Dowa

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:

[view.po_frameBuilder setWidth:100.0f height:40.0f];

Moving a view to be centered within it’s superview:

[view.po_frameBuilder centerInSuperview];

You can combine these methods to your own liking:

[[view.po_frameBuilder setWidth:100.0f height:40.0f] centerHorizontallyInSuperview];

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments