You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PinLayout.podspec
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
#
17
17
18
18
s.name="PinLayout"
19
-
s.version="1.2.3"
19
+
s.version="1.2.4"
20
20
s.summary="Fast Swift UIViews layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable."
21
21
22
22
# This description is used to generate tags and improve search results.
Copy file name to clipboardExpand all lines: README.md
+85-71Lines changed: 85 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,26 +220,26 @@ PinLayout can position a view’s edge relative to its superview edges.
220
220
The value specifies the top edge distance from the superview's top edge in pixels.
221
221
***`top(_ percent: Percent)`**
222
222
The value specifies the top edge distance from the superview's top edge in percentage of its superview's height.
223
-
***`left(_ value: CGFloat)`**
224
-
The value specifies the left edge distance from the superview's left edge in pixels.
225
-
***`left(_ percent: Percent)`**
226
-
The value specifies the left edge distance from the superview's left edge in percentage of its superview's width.
223
+
***`vCenter(_ value: CGFloat)`**
224
+
The value specifies the vertical center distance from the superview's top edge in pixels.
225
+
***`vCenter(_ percent: Percent)`**
226
+
The value specifies the vertical center distance from the superview's top edge in percentage of its superview's height.
227
227
***`bottom(_ value: CGFloat)`**
228
228
The value specifies the bottom edge **distance from the superview's bottom edge** in pixels.
229
229
***`bottom(_ percent: Percent)`**
230
230
The value specifies the bottom edge **distance from the superview's bottom edge** in percentage of its superview's height.
231
-
***`right(_ value: CGFloat)`**
232
-
The value specifies the right edge **distance from the superview's right edge** in pixels.
233
-
***`right(_ percent: Percent)`**
234
-
The value specifies the right edge **distance from the superview's right edge** in percentage of its superview's width.
231
+
***`left(_ value: CGFloat)`**
232
+
The value specifies the left edge distance from the superview's left edge in pixels.
233
+
***`left(_ percent: Percent)`**
234
+
The value specifies the left edge distance from the superview's left edge in percentage of its superview's width.
235
235
***`hCenter(_ value: CGFloat)`**
236
236
The value specifies the horizontal center distance from the superview's left edge in pixels.
237
237
***`hCenter(_ percent: Percent)`**
238
238
The value specifies the horizontal center distance from the superview's left edge in percentage of its superview's width.
239
-
***`vCenter(_ value: CGFloat)`**
240
-
The value specifies the vertical center distance from the superview's top edge in pixels.
241
-
***`vCenter(_ percent: Percent)`**
242
-
The value specifies the vertical center distance from the superview's top edge in percentage of its superview's height.
239
+
***`right(_ value: CGFloat)`**
240
+
The value specifies the right edge **distance from the superview's right edge** in pixels.
241
+
***`right(_ percent: Percent)`**
242
+
The value specifies the right edge **distance from the superview's right edge** in percentage of its superview's width.
243
243
***`start(_ value: CGFloat)`**:left_right_arrow:
244
244
In LTR direction the value specifies the left edge distance from the superview's left edge in pixels.
245
245
In RTL direction the value specifies the right edge distance from the superview's right edge in pixels.
@@ -285,20 +285,20 @@ PinLayout also has a shorter version that pins a view’s edge **directly** on i
285
285
286
286
***`top()`**
287
287
Position the view top edge directly on its superview top edge. Similar to calling `top(0)`.
288
-
***`left()`**
289
-
Position the view left edge directly on its superview left edge. Similar to calling `left(0)`.
288
+
***`vCenter()`**
289
+
Position vertically the view's center directly on its superview vertical center. Similar to calling `vCenter(0)`.
290
290
***`bottom()`**
291
291
Position the view bottom edge directly on its superview top edge. Similar to calling `bottom(0)`.
292
+
***`left()`**
293
+
Position the view left edge directly on its superview left edge. Similar to calling `left(0)`.
294
+
***`hCenter()`**
295
+
Position horizontally the view's center directly on its superview horizontal center. Similar to calling `hCenter(0)`.
292
296
***`right()`**
293
297
Position the view right edge directly on its superview right edge. Similar to calling `right(0)`.
294
298
***`start()`**:left_right_arrow:
295
299
Position the view left edge directly on its superview left edge in LTR direction or right edge directly on its superview right edge in RTL direction. Similar to calling `start(0)`.
296
300
***`end()`**:left_right_arrow:
297
301
Position the view right edge directly on its superview right edge in LTR direction or left edge directly on its superview left edge in RTL direction. Similar to calling `end(0)`.
298
-
***`hCenter()`**
299
-
Position the view horizontal center directly on its superview horizontal center. Similar to calling `hCenter(superview.frame.width / 2)`.
300
-
***`vCenter()`**
301
-
Position the view vertical center directly on its superview vertical center. Similar to calling `hCenter(superview.frame.height / 2)`.
302
302
303
303
###### Usage examples:
304
304
```swift
@@ -319,6 +319,73 @@ This example is similar to the previous example, but pins edges directly on supe
319
319
320
320
<br/>
321
321
322
+
## Edges <aname="edges"></a>
323
+
324
+
### PinLayout UIView’s edges
325
+
326
+
PinLayout adds edges properties to UIViews. These properties are used to reference other view’s edges.
327
+
328
+
**PinLayout UIView’s edges**:
329
+
330
+
*`UIView.edge.top`
331
+
*`UIView.edge.vCenter`
332
+
*`UIView.edge.bottom`
333
+
*`UIView.edge.left`
334
+
*`UIView.edge.hCenter`
335
+
*`UIView.edge.right`
336
+
*`UIView.edge.start`:left_right_arrow:
337
+
*`UIView.edge.end`:left_right_arrow:
338
+
339
+

340
+
341
+
<br/>
342
+
343
+
### Layout using edges
344
+
345
+
PinLayout has methods to attach a UIView's edge (top, left, bottom, right, start or end edge) to another view’s edge.
346
+
347
+
**Methods:**
348
+
349
+
***`top(to edge: ViewEdge)`**:
350
+
Position the view's top edge directly on another view’s edge (top/vCenter/bottom).
351
+
***`vCenter(to edge: ViewEdge)`**:
352
+
Position vertically the view's center directly on another view’s edge (top/vCenter/bottom).
353
+
***`bottom(to edge: ViewEdge)`**:
354
+
Position the view's bottom edge directly on another view’s edge (top/vCenter/bottom).
355
+
***`left(to: edge: ViewEdge)`**:
356
+
Position the view's left edge directly on another view’s edge (left/hCenter/right).
357
+
***`hCenter(to: edge: ViewEdge)`**:
358
+
Position horizontally the view's center directly on another view’s edge (left/hCenter/right).
359
+
***`right(to: edge: ViewEdge)`**:
360
+
Position the view's right edge directly on another view’s edge (left/hCenter/right).
In LTR direction it position the view's left edge directly on another view’s edge.
363
+
In RTL direction it position the view's right edge directly on another view’s edge.
364
+
***`end(to: edge: ViewEdge)`**:left_right_arrow:
365
+
In LTR direction it position the view's top edge directly on another view’s edge.
366
+
In RTL direction it position the view's bottom edge directly on another view’s edge.
367
+
368
+
:pushpin: These methods can pin a view’s edge to any other view's edge, even if don't have the same direct superview! It works with any views that have at some point the same ancestor.
:pushpin: These methods can pin a view’s edge to any other view's edge, even if don't have the same direct superview! It works with any views that have at some point the same ancestor.
0 commit comments