Skip to content

Commit 2a76012

Browse files
Luc DionLuc Dion
authored andcommitted
update doc
1 parent ef0bed7 commit 2a76012

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

Docs/Notes.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
- Add a doc example using width(40%).height(100%)
1414

15+
- Optimization: Use a bit mask to check rapidly which properties has been set. ex: if propertiesMask & (TOP | BOTTOM) { ... }
16+
1517
- Antoine Lamy: Suggestion pour ton système de layout (pt déjà le cas): Utiliser une interface entre l'engin de layout et
1618
UIKit afin de potentiellement être capable de le bridger vers d'autres entitées visuelles qu'une
1719
UIView (exemple: CALayer, NSView, ASDisplayNode, etc). L'engin n'a probablement à dealer qu'avec des
@@ -27,6 +29,13 @@
2729
pin.view.fill(), pin.fillHorizontally(), pin.fillVertically()
2830
pin.toSuperview()
2931

32+
* `allEdges()`
33+
Position
34+
* `verticalEdges()`
35+
Position
36+
* `horizontalEdges()`
37+
Position
38+
3039
- Percentages (see https://github.com/freshOS/Stevia/blob/master/Source/Stevia%2BPercentage.swift)
3140
pin.top(5%)
3241
pin.left(20%)

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,29 @@ PinLayout can position a view’s edge relative to its superview edges.
9999
**Methods**:
100100

101101
* `top(_ value: CGFloat)`
102-
The value specifies the distance in pixels between the top edge of the view and the top edge of its to superview
102+
The value specifies the top edge distance from the superview's top edge in pixels.
103+
* `top(_ percent: Percent)`
104+
The value specifies the top edge distance from the superview's top edge in percentage of its superview's height.
103105
* `left(_ value: CGFloat)`
104-
The value specifies the distance in pixels between the left edge of the view and the left edge of its to superview
106+
The value specifies the left edge distance from the superview's left edge in pixels.
107+
* `left(_ percent: Percent)`
108+
The value specifies the left edge distance from the superview's left edge in percentage of its superview's width.
105109
* `bottom(_ value: CGFloat)`
106-
The value specifies the distance in pixels between the bottom edge of the view and the bottom edge of its to superview.
110+
The value specifies the bottom edge distance from the superview's bottom edge in pixels.
111+
* `bottom(_ percent: Percent)`
112+
The value specifies the bottom edge distance from the superview's bottom edge in percentage of its superview's height.
107113
* `right(_ value: CGFloat)`
108-
The value specifies the distance in pixels between the right edge of the view and the right edge of its to superview.
114+
The value specifies the right edge distance from the superview's right edge in pixels.
115+
* `right(_ percent: Percent)`
116+
The value specifies the right edge distance from the superview's right edge in percentage of its superview's width.
109117
* `hCenter(_ value: CGFloat)`
110-
The value specifies the distance in pixels between the horizontal center of the view and the left edge of its to superview.
118+
The value specifies the horizontal center distance from the superview's left edge in pixels.
119+
* `hCenter(_ percent: Percent)`
120+
The value specifies the horizontal center distance from the superview's left edge in percentage of its superview's width.
111121
* `vCenter(_ value: CGFloat)`
112-
The value specifies the distance in pixels between the vertical center of the view and the top edge of its to superview.
122+
The value specifies the vertical center distance from the superview's top edge in pixels.
123+
* `vCenter(_ percent: Percent)`
124+
The value specifies the vertical center distance from the superview's top edge in percentage of its superview's height.
113125

114126
###### Usage Examples:
115127

@@ -148,13 +160,10 @@ Position the view left edge directly on its superview top edge. Similar to calli
148160
Position the view bottom edge directly on its superview top edge. Similar to calling bottom(0)
149161
* `right()`
150162
Position the view right edge directly on its superview top edge. Similar to calling right(0)
151-
152-
* `allEdges()`
153-
Position
154-
* `verticalEdges()`
155-
Position
156-
* `horizontalEdges()`
157-
Position
163+
* `hCenter()`
164+
Position the view horizontal center directly on its superview horizontal center. Similar to calling hCenter(0).
165+
* `vCenter()`
166+
Position the view vertical center directly on its superview vertical center. Similar to calling vCenter(0).
158167

159168
###### Usage examples:
160169
```javascript
@@ -421,24 +430,24 @@ PinLayout have methods to set the view’s height and width.
421430

422431
**Methods:**
423432

424-
* `width(percent: Percent)`
425-
The value specifies the width of the view in percent relative to its superview (container). Value must be non-negative.
426433
* `width(_ width: CGFloat)`
427434
The value specifies the width of the view in pixels. Value must be non-negative.
435+
* `width(percent: Percent)`
436+
The value specifies the width of the view in percentage of its superview. Value must be non-negative.
428437
* `width(of view: UIView)`
429438
Set the view’s width to match the referenced view’s width.
430439

431-
* `height(percent: Percent)`
432-
The value specifies the height of the view in percent relative to its superview (container). Value must be non-negative.
433440
* `height(_ height: CGFloat)`
434441
The value specifies the height of the view in pixels.
442+
* `height(percent: Percent)`
443+
The value specifies the height of the view in percentage of its superview. Value must be non-negative.
435444
* `height(of view: UIView)`
436445
Set the view’s height to match the referenced view’s height
437446

438447
* `size(_ size: CGSize)`
439448
The value specifies the size (width and value) of the view in pixels. Values must be non-negative.
440449
* `size(_ percent: Percent)`
441-
The value specifies the width and the height of the view in percent relative to its superview (container), creating a square view. Values must be non-negative.
450+
The value specifies the width and the height of the view in percentage of its superview. Values must be non-negative.
442451
* `size(_ sideLength: CGFloat)`
443452
The value specifies the width and the height of the view in pixels, creating a square view. Values must be non-negative.
444453
* `size(of view: UIView)`

0 commit comments

Comments
 (0)