NSView(DTAutoLayout) Category Reference
Declared in | NSView+DTAutoLayout.h |
Instance Methods
addLayoutConstraintWithWidthGreaterOrEqualThan:
Creates and adds a layout contraint to the receiver that enforces a minimum width.
- (void)addLayoutConstraintWithWidthGreaterOrEqualThan:(CGFloat)width
Parameters
- width
The width to enforce
Declared In
NSView+DTAutoLayout.h
addLayoutConstraintsForSubview:edgeInsets:
Pins the edges of a subview to edges of the receiver.
- (void)addLayoutConstraintsForSubview:(NSView *)subview edgeInsets:(NSEdgeInsets)edgeInsets
Parameters
- subview
The subview to tie to the receiver
- edgeInsets
The insets from the receiver’s frame. Negative values are from the opposite edge.
Discussion
To pin a view at the top of its superview:
// 22 px high at top full width
[self addLayoutConstraintsForSubview:barView edgeInsets:NSEdgeInsetsMake(0, 0, -22, 0)];
To have a view underneath it
// rest of view spaced 22 px from top
[self addLayoutConstraintsForSubview:_tabView edgeInsets:NSEdgeInsetsMake(22, 0, 0, 0)];
Declared In
NSView+DTAutoLayout.h