-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfff861
commit c0fbc6f
Showing
69 changed files
with
905 additions
and
180 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
Title: ld_constrainView | ||
--- | ||
Constrain specified anchors from one view to another with optional constants. | ||
|
||
#- Parameters | ||
- primaryView `UIView` | ||
- View to be anchored. | ||
|
||
- secondaryView `UIView` | ||
- View to be anchored to. | ||
|
||
- anchors `string` | ||
- Anchors to add constraints to. Abbreviations are used and each should be separated by a string. | ||
- <span style="color:#DE2218">w</span> | ||
- Width Anchor | ||
|
||
- <span style="color:#DE2218">h</span> | ||
- Height Anchor | ||
|
||
- <span style="color:#DE2218">x</span> | ||
- Center X Anchor | ||
|
||
- <span style="color:#DE2218">y</span> | ||
- Center Y Anchor | ||
|
||
- <span style="color:#DE2218">top</span> | ||
- Top Anchor | ||
|
||
- <span style="color:#DE2218">bottom</span> | ||
- Bottom Anchor | ||
|
||
- <span style="color:#DE2218">leading</span> | ||
- Leading Anchor | ||
|
||
- <span style="color:#DE2218">trailing</span> | ||
- Trailing Anchor | ||
|
||
- constants `LDLayoutConstants` | ||
- Struct with constants for each anchor. Multiple helper functions to allow to create `LDLayoutConstants`. | ||
|
||
- Return Value `array` | ||
- Array of constraints added to the `primaryView`. Each constraint's identifier is set to the corresponding anchor used for the constraint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! Declaration | ||
```objc | ||
+(NSArray <NSLayoutConstraint *>*)ld_constrainView:(UIView *)primaryView toView:(UIView *)secondaryView anchors:(NSString *)anchors constants:(LDLayoutConstants)constants; | ||
+(NSArray <NSLayoutConstraint *>*)ld_constrainView:(UIView *)primaryView toView:(UIView *)secondaryView anchors:(NSString *)anchors; | ||
``` | ||
|
||
#! Example Usage | ||
```objc | ||
[NSLayoutConstraint ld_constrainView:firstView toView:otherView anchors:@"w, h" constants:LDSizeConstantsMake(100, 50)]; | ||
|
||
[NSLayoutConstraint ld_constrainView:firstView toView:otherView anchors:@"x, leading, trailing"]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
Title: ld_centerView | ||
--- | ||
Constrain view to the center X and Y anchors of a specified view. Also add height and width anchors. | ||
|
||
#- Parameters | ||
- primaryView `UIView` | ||
- View to be anchored. | ||
|
||
- secondaryView `UIView` | ||
- View to be anchored to. | ||
|
||
- constants `LDLayoutConstants` | ||
- Struct with constants for each anchor. Multiple helper functions to allow to create `LDLayoutConstants`. | ||
|
||
- Return Value `array` | ||
- Array of constraints added to the `primaryView`. Each constraint's identifier is set to the corresponding anchor used for the constraint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#! Declaration | ||
```objc | ||
+(NSArray <NSLayoutConstraint *>*)ld_centerView:(UIView *)primaryView inView:(UIView *)secondaryView constants:(LDLayoutConstants)constants; | ||
``` | ||
|
||
#! Example Usage | ||
```objc | ||
[NSLayoutConstraint ld_centerView:firstView inView:otherView constants:LDSizeConstantsMake(200, 40)]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
Title: ld_sizeView | ||
--- | ||
Constrain view's width and height anchors to constants. | ||
|
||
#- Parameters | ||
- primaryView `UIView` | ||
- View to be anchored. | ||
|
||
- secondaryView `UIView` | ||
- View to be anchored to. | ||
|
||
- constants `LDLayoutConstants` | ||
- Struct with constants for each anchor. Multiple helper functions to allow to create `LDLayoutConstants`. | ||
|
||
- Return Value `array` | ||
- Array of constraints added to the `primaryView`. Each constraint's identifier is set to the corresponding anchor used for the constraint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#! Declaration | ||
```objc | ||
+(NSArray <NSLayoutConstraint *>*)ld_sizeView:(UIView *)primaryView inView:(UIView *)secondaryView constants:(LDLayoutConstants)constants; | ||
``` | ||
|
||
#! Example Usage | ||
```objc | ||
[NSLayoutConstraint ld_sizeView:firstView inView:otherView constants:LDSizeConstantsMake(96, 82)]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
Title: LDLayoutConstants | ||
--- | ||
Struct with constants for each anchor. Multiple helper functions to allow to create `LDLayoutConstants`. | ||
|
||
#- Parameters | ||
- width `float` | ||
- Width anchor constant. | ||
|
||
- height `float` | ||
- Height anchor constant. | ||
|
||
- x `float` | ||
- Center X anchor constant. | ||
|
||
- y `float` | ||
- Center Y anchor constant. | ||
|
||
- top `float` | ||
- Top anchor constant. | ||
|
||
- bottom `float` | ||
- Bottom anchor constant. | ||
|
||
- leading `float` | ||
- Leading anchor constant. | ||
|
||
- trailing `float` | ||
- Trailing anchor constant. | ||
|
||
- Return Value `LDLayoutConstants` | ||
- Constants to be used with ParvusConstraint. | ||
|
||
--- | ||
#- Functions | ||
- LDLayoutConstantsMake() | ||
- Function with parameters for each constant. Very long. | ||
|
||
- LDSelectConstantsMake() | ||
- Function using a dictionary to set only specific constants. | ||
- <span style="color:#DE2218">w</span> | ||
- Width Constant | ||
|
||
- <span style="color:#DE2218">h</span> | ||
- Height Constant | ||
|
||
- <span style="color:#DE2218">x</span> | ||
- Center X Constant | ||
|
||
- <span style="color:#DE2218">y</span> | ||
- Center Y Constant | ||
|
||
- <span style="color:#DE2218">tp</span> | ||
- Top Constant | ||
|
||
- <span style="color:#DE2218">b</span> | ||
- Bottom Constant | ||
|
||
- <span style="color:#DE2218">l</span> | ||
- Leading Constant | ||
|
||
- <span style="color:#DE2218">tl</span> | ||
- Trailing Constant | ||
|
||
- LDSizeConstantsMake() | ||
- Function with parameters only for width and height constants. | ||
|
||
- LDEdgeConstantsMake() | ||
- Function with parameters for top, bottom, leading, and trailing constants. |
29 changes: 29 additions & 0 deletions
29
docuowl/ParvusConstraint/4.LDLayoutConstraints/sidenotes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! Declaration | ||
```objc | ||
struct LDLayoutConstants { | ||
CGFloat width; | ||
CGFloat height; | ||
CGFloat x; | ||
CGFloat y; | ||
CGFloat top; | ||
CGFloat bottom; | ||
CGFloat leading; | ||
CGFloat trailing; | ||
}; | ||
``` | ||
|
||
#! Example Usage | ||
```objc | ||
LDLayoutConstants constants; | ||
constants.width = 100; | ||
constants.top = -5; | ||
constants.y = 23; | ||
``` | ||
|
||
#! Functions | ||
```objc | ||
LDLayoutConstants LDLayoutConstantsMake(CGFloat width, CGFloat height, CGFloat x, CGFloat y, CGFloat top, CGFloat bottom, CGFloat leading, CGFloat trailing); | ||
LDLayoutConstants LDSelectConstantsMake(NSDictionary <NSString *, NSNumber *>*constantsDict); | ||
LDLayoutConstants LDSizeConstantsMake(CGFloat width, CGFloat height); | ||
LDLayoutConstants LDEdgeConstantsMake(CGFloat top, CGFloat bottom, CGFloat leading, CGFloat trailing); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
Title: ParvusConstraint | ||
--- | ||
Additions to NSLayoutConstraint that allows for (limited) easier constraints. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.