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: README.md
+28-21Lines changed: 28 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Extremely Fast views layouting without auto layout. No magic, pure code, full co
37
37
* Swift 3.2+ / Swift 4.0 / Objective-C
38
38
39
39
### Recent features
40
-
*:star: Add methods `wrapConten(...)` that adjust the view's width & height to wrap all its subviews. See [wrapContent](#wrapCcontent) for more information.
40
+
*:star: Add `wrapContent()`methods that adjust view's width & height to wrap all its subviews. See [wrapContent](#wrapContent) for more information.
41
41
42
42
*:star: PinLayout now support macOS. See [macOS Support](#macos_support) for more information.
43
43
@@ -1137,50 +1137,57 @@ This example runs perfectly on a iPhone X (iOS 11), but it also runs on any devi
1137
1137
1138
1138
<br/>
1139
1139
1140
-
<aname="wrapCcontent"></a>
1140
+
<aname="wrapContent"></a>
1141
1141
## WrapContent
1142
1142
1143
-
The following methods are useful to adjust the view's width and/or height to wrap all its subviews. These method also adjust subviews position to create a tight wrap.
1143
+
The following methods are useful to adjust view's width and/or height to wrap all its subviews. These methods also adjust subviews position to create a tight wrap.
1144
1144
1145
1145
**Methods:**
1146
1146
1147
1147
***`wrapContent()`**
1148
-
Bla.
1149
-
***`wrapContent(padding: CGFloat)`**
1150
-
Bla.
1151
-
***`wrapContent(padding: UIEdgeInsets)`**
1152
-
Bla.
1148
+
**`wrapContent(padding: CGFloat)`**
1149
+
**`wrapContent(padding: UIEdgeInsets)`**
1150
+
Adjust the view's width and height to wrap all its subviews. The method also adjusts subviews position to create a tight wrap. It is also possible to specify an optional padding around all subviews.
Adjust the view's width AND/OR height to wrap all its subviews. WrapType values are `.horizontally`/`.vertically`/`.all` It is also possible to specify an optional padding around all subviews.
1161
1154
1162
1155
###### Usage examples:
1163
1156
```swift
1164
1157
view.pin.wrapContent().center() // wrap all subviews and centered the view inside its parent.
1165
1158
view.pin.wrapContent(padding: 20) // wrap all subviews with a padding of 20 pixels all around
1159
+
view.pin.wrapContent(.horizontally)
1166
1160
```
1167
1161
1168
-
1169
1162
###### Example:
1170
-
...:
1163
+
This example show the result of different `wrapContent()` method calls.
|`view.pin.wrapContent()`| <imgsrc="docs/images/wrapContent_all.png"width="200"/> | Adjust the view's height and width to tight fit its subviews. |
1171
+
|`view.pin.wrapContent(padding: 10)`| <imgsrc="docs/images/wrapContent_padding.png"width="200"/> | Adjust the view's height and width and add a padding of 10 pixels around its subviews. |
1172
+
|`view.pin.wrapContent(.horizontally)`| <imgsrc="docs/images/wrapContent_horizontally.png"width="200"/> | Adjust only the view's width. |
1173
+
|`view.pin.wrapContent(.vertically)`| <imgsrc="docs/images/wrapContent_vertically.png"width="200"/> | Adjust only the view's height. |
1174
+
1175
+
1176
+
###### Example:
1177
+
This example shows how a view (`containerView`) with two subviews (`imageView` and `label`), can be adjusted to the size of its subviews and then centered inside its parent.
* Line 1: Position the label below the imageView aligned on its center with a top margin of 4 pixels.
1186
+
* Line 2: Adjust the `containerView`'s size and position its subviews to create a tight wrap around them, and then it center the `containerView` inside its parent (superview).
0 commit comments