PinLayout v1.3.2 Release Notes
-
🔄 Change
Add aspectRatio methods:
aspectRatio(_ ratio: CGFloat)
:
Set the view aspect ratio. If a single dimension is set (either width or height), the aspect ratio will be used to compute the other dimension.
- AspectRatio is defined as the ratio between the width and the height (width / height).
- An aspect ratio of 2 means the width is twice the size of the height.
- AspectRatio respects the min (minWidth/minHeight) and the max (maxWidth/maxHeight) dimensions of an item. Set all margins using an UIEdgeInsets. This method is particularly useful to set all margins using iOS 11 UIView.safeAreaInsets
aspectRatio(of view: UIView)
:
Set the view aspect ratio using another UIView's aspect ratio.
AspectRatio is applied only if a single dimension (either width or height) can be determined, in that case the aspect ratio will be used to compute the other dimension.
- AspectRatio is defined as the ratio between the width and the height (width / height).
- AspectRatio respects the min (minWidth/minHeight) and the max (maxWidth/maxHeight)
dimensions of an item.
aspectRatio()
:
If the layouted view is an UIImageView, this method will set the aspectRatio using the UIImageView's image dimension.
For other types of views, this method as no impact.