Skip to content

Commit e97ac71

Browse files
Luc DionLuc Dion
authored andcommitted
Update doc
1 parent f176543 commit e97ac71

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Swift manual views layouting without auto layout, no magic, pure code, full cont
3434
* [Warnings](#warnings)
3535
* [More examples](#more_examples)
3636

37+
* [FAQ](#faq)
38+
* [Comments, ideas, suggestions, issues, ....](#comments)
39+
3740
<br>
3841

3942
## PinLayout principles and philosophy <a name="introduction"></a>
@@ -122,6 +125,8 @@ override func layoutSubviews() {
122125

123126
:pushpin: This example and some other examples are available in the **PinLayoutSample** project. Please note that you must do a `pod install` before running the sample project.
124127

128+
:pushpin: PinLayout doesn't use auto layout constraints, it is a framework that manually layout views. For that reason you need to update the layout inside either `UIView.layoutSubviews()` or `UIViewController.viewDidLayoutSubviews()` to handle container size's changes, including device rotation. You'll also need to handle UITraitCollection changes for app's that support multitask. In the example above PinLayout's commands are inside UIView's `layoutSubviews()` method.
129+
125130
<br/>
126131

127132

@@ -773,7 +778,22 @@ Cell D:
773778

774779
<br>
775780

776-
## Comments, ideas, suggestions, issues, ....
781+
782+
## FAQ <a name="faq"></a>
783+
784+
* **Q: When the device rotation change, the layout is not updated.**
785+
**R:** PinLayout doesn't use auto layout constraints, it is a framework that manually layout views. For that reason you need to update the layout inside either `UIView.layoutSubviews()` or `UIViewController.viewDidLayoutSubviews()` to handle container size's changes, including device rotation. You'll also need to handle UITraitCollection changes for app's that support multitask.
786+
787+
* **Q: How to apply percentage from a CGFloat, a Float or a Int value?**
788+
**R:** Many PinLayout's method has a parameter of type `Percent`. You can easily specify this type of parameter simply by adding the `%` operator to your value (eg: `view.pin.left(10%).width(50%)`. It is similar if you have a value of type CGFloat, Float or Int, simply adds the `%` operator:
789+
790+
```
791+
let percentageValue: CGFloat = 50
792+
view.pin.width(percentageValue%)
793+
```
794+
<br>
795+
796+
## Comments, ideas, suggestions, issues, .... <a name="comments"></a>
777797
For any **comments**, **ideas**, **suggestions**, **issues**, simply open an [issue](https://github.com/mirego/PinLayout/issues).
778798

779799
<br>

0 commit comments

Comments
 (0)