WeView 2

An alternative to iOS Auto Layout

Tutorial 7: Subview Properties

WeView 2 adds a number of properties to all UIViews that can be used to control their layout.

These properties are stored using Associated Objects, so subviews don’t need to extend any class or implement any interface.

These properties are added using the UIView+WeView category.

Stretch

The stretch properties can be used to control whether or not the subview has a fixed size or whether it can stretch to fill any extra space in its superview’s bounds.

Most of the time, you won’t need to specify a specific stretch weight and can simply use of the following convenience methods:

- (UIView *)setHStretches;
- (UIView *)setVStretches;
- (UIView *)setStretches;

See the Stretch section of the tutorial.

Sizing

The sizing properties can be used to control the subview’s size. See the Sizing section of the tutorial.

Cell Alignment

The cell alignment properties can be used to control the alignment of the subview within its layout cell. See the Layout Model section of the tutorial.