• This repository has been archived on 20/Apr/2020
  • Stars
    star
    383
  • Rank 111,995 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small library for semantic layout of UIViews.

POViewFrameBuilder

POViewFrameBuilder aims to provide a simple way to layout UIViews programatically while maintaining the semantics and readability of the code. It lets you modify a view's frame by chaining a series of readable layout methods. It reduces the amount of frame calculation code and keeps the intent of your layout clear. A handy tool for your average layoutSubviews, animation block etc.

It is by no means complete, but rather contains a number of methods I have happened to need at various occasions. Feedback and pull requests are very welcome.

Usage

The following two examples give you a brief introduction on how POViewFrameBuilder can be used. Just include the UIView+POViewFrameBuilder.h category where you want to use it, and then you can access the po_frameBuilder convenience property to instantiate a frame builder for any UIView subclass.

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];

Demo

The DemoApp project shows how POViewFrameBuilder can be used in animation blocks. One thing to note is that by default, the automaticallyCommitChanges property is set to YES. This means that the frame changes are committed after every modifying method in the chain. However, having multiple frame changes in an animation doesn't work, and the view ends up jumping around. To avoid this, begin the method chain by calling disableAutoCommit and finish the series of changes by calling the commit method, which will update the view's frame:

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

Thanks to @rsobik, there is now also a shorter and more readable way to create these transactions:

[self.squareView.po_frameBuilder update:^(POViewFrameBuilder *builder) {
	[builder setWidth:100.0f height:40.0f];
	[builder centerHorizontallyInSuperview];
}];

More Repositories

1

jquery-mentions-input

JavaScript
984
star
2

valideer

Lightweight data validation and adaptation Python library.
Python
263
star
3

requirejs-react-jsx

A RequireJS plugin for loading jsx in development and compiling (with r.js). Supports bundling and 1:1 source maps in development and production.
JavaScript
104
star
4

podio-rb

The official Ruby wrapper for the Podio API used and maintained by the Podio team
Ruby
66
star
5

podio-py

Podio Python client
Python
48
star
6

podio-js

Official Podio JavaScript SDK for node and the browser
JavaScript
45
star
7

podio-objc

PodioKit is the Objective-C client library for the Podio API.
Objective-C
26
star
8

podio-dotnet

Podio .NET client
C#
19
star
9

podio_rails_sample

Sample Rails project with authentication and item read/create
Ruby
18
star
10

podio-java

The Java client for the Podio API. This will be a full mapping of the Podio API to an easy to use Java library.
Java
18
star
11

istanbul-react

Instrumenter for 1:1 mapping of React JSX components. Can be used with karma-coverage
JavaScript
12
star
12

podio-android

The Android SDK for the Podio API.
Java
9
star
13

sample-basecamp

Ruby
9
star
14

asp-net-sample

ASP.NET MVC example of using Podio
C#
8
star
15

sample-dropbox

Downloads files from Podio and uploads them to your dropbox. Done by the Team Dropbox!
Java
7
star
16

sample-jenkins

A plugin for Hudson that will post build results to an app in Podio. On failed builds tasks will be created for the relevant users.
Java
7
star
17

conssert

Content Assertion library for Python
Python
5
star
18

sample-alerts

Integration between Google Alerts and Podio
Java
4
star
19

platform-todo-app-tutorial

JavaScript
4
star
20

plugin-jst

JST loader plugin
JavaScript
2
star
21

sample-flask

JavaScript
2
star
22

sample-twitter

Example of integration between Podio and Twitter built on the Podio API and it's Java client
Java
2
star
23

node-requirejs

Lets you use you requirejs configuration in Node
JavaScript
1
star
24

work_quest_frontend

WorkQuest frontend
Ruby
1
star
25

integration-zendesk

An incomplete Java interface to the Zendesk API
Java
1
star
26

sample-delicious

Simple importer that will parse RSS feeds from delicious and post them in an app in Podio.
Java
1
star
27

openpyxl

copy of https://bitbucket.org/hlmrn/openpyxl@a00915cc57bd89086fd0a2ffa52436f5abe0fdbd
Python
1
star