Skip to content

Commit 8f00cc4

Browse files
committed
Update with latest UIView+AutoLayout v2.0.0
1 parent b319abb commit 8f00cc4

2 files changed

Lines changed: 161 additions & 136 deletions

File tree

TableViewCellWithAutoLayout/UIView+AutoLayout/UIView+AutoLayout.h

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// UIView+AutoLayout.h
3-
// v1.2.0
3+
// v2.0.0
44
// https://github.com/smileyborg/UIView-AutoLayout
55
//
66
// Copyright (c) 2012 Richard Turton
@@ -87,22 +87,22 @@ typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UI
8787
+ (void)autoRemoveConstraints:(NSArray *)constraints;
8888

8989
/** Removes all explicit constraints that affect the view.
90-
WARNING: Apple's constraint solver is not optimized for large-scale constraint changes; you may encounter major performance issues after using this method.
90+
WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method.
9191
NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */
9292
- (void)autoRemoveConstraintsAffectingView;
9393

9494
/** Removes all constraints that affect the view, optionally including implicit constraints.
95-
WARNING: Apple's constraint solver is not optimized for large-scale constraint changes; you may encounter major performance issues after using this method.
95+
WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method.
9696
NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */
9797
- (void)autoRemoveConstraintsAffectingViewIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints;
9898

9999
/** Recursively removes all explicit constraints that affect the view and its subviews.
100-
WARNING: Apple's constraint solver is not optimized for large-scale constraint changes; you may encounter major performance issues after using this method.
100+
WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method.
101101
NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */
102102
- (void)autoRemoveConstraintsAffectingViewAndSubviews;
103103

104104
/** Recursively removes all constraints from the view and its subviews, optionally including implicit constraints.
105-
WARNING: Apple's constraint solver is not optimized for large-scale constraint changes; you may encounter major performance issues after using this method.
105+
WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method.
106106
NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */
107107
- (void)autoRemoveConstraintsAffectingViewAndSubviewsIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints;
108108

@@ -127,6 +127,9 @@ typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UI
127127
/** Pins the edges of the view to the edges of its superview with the given edge insets. */
128128
- (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets;
129129

130+
/** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */
131+
- (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets excludingEdge:(ALEdge)edge;
132+
130133

131134
#pragma mark Pin Edges
132135

@@ -216,22 +219,6 @@ typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UI
216219
/** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. */
217220
- (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset;
218221

219-
220-
#pragma mark Deprecated API Methods
221-
222-
/** DEPRECATED as of v1.1, will be removed at some point in the future. Use -[autoAlignAxisToSuperviewAxis:] instead.
223-
(This method has simply been renamed due to confusion. The replacement method works identically.)
224-
Centers the view along the given axis (horizontal or vertical) within its superview. */
225-
- (NSLayoutConstraint *)autoCenterInSuperviewAlongAxis:(ALAxis)axis __attribute__((deprecated));
226-
227-
/** DEPRECATED as of v1.1, will be removed at some point in the future. Use -[autoConstrainAttribute:toAttribute:ofView:withOffset:] instead.
228-
Pins the given center axis of the view to a fixed position (X or Y value, depending on axis) in the superview. */
229-
- (NSLayoutConstraint *)autoPinCenterAxis:(ALAxis)axis toPositionInSuperview:(CGFloat)value __attribute__((deprecated));
230-
231-
/** DEPRECATED as of v1.1, will be removed at some point in the future. Use -[autoPinEdgeToSuperviewEdge:withInset:] instead.
232-
Pins the given edge of the view to a fixed position (X or Y value, depending on edge) in the superview. */
233-
- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toPositionInSuperview:(CGFloat)value __attribute__((deprecated));
234-
235222
@end
236223

237224

@@ -263,9 +250,15 @@ typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UI
263250
/** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */
264251
- (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing alignment:(NSLayoutFormatOptions)alignment;
265252

253+
/** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */
254+
- (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment;
255+
266256
/** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */
267257
- (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size alignment:(NSLayoutFormatOptions)alignment;
268258

259+
/** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */
260+
- (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment;
261+
269262
@end
270263

271264

@@ -276,6 +269,9 @@ typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UI
276269
*/
277270
@interface NSLayoutConstraint (AutoLayout)
278271

272+
/** Adds the constraint to the appropriate view. */
273+
- (void)autoInstall;
274+
279275
/** Removes the constraint from the view it has been added to. */
280276
- (void)autoRemove;
281277

0 commit comments

Comments
 (0)