A Brief Introduction To UIStackview
Posted By : Gunjan Gumber | 29-Apr-2018
In this blog, I have given a brief introduction about UIStackview introduced in iOS 9, and also explained how can we use UIStackview
iOS 9 has introduced UISTACKVIEW which has made complex UIDesign much easier and saved developer from implementing the number of constraints for giving equal spacing, proportional spacing etc.
According to the requirement, iOS 9 has provided both vertical stack view and horizontal stack view. To create a stack view drag and drop a vertical
Now just drag and drop the UI elements in the
UIStackView Alignment
On the basis of an axis, we can choose how to align the elements into available space. If we select vertical axis, then we can align elements to the leading, trailing and center of the stack view and when we select horizontal axis, then we can align elements to top, center or bottom.
UIStackview properties
Here are some of the properties that define the how the stack view layout its content.
- axis - stack view’s orientation can be determined by axis property, its orientation can be vertical or horizontal.
- distribution - a layout of the arranged views can be determined to be determined to buy this property, along with the stock’s axis
- isLayoutMarginsRelativeArrange
ment - we can determine whether the stack view lays out its arranged views relative to its layout margins. - spacing - this property is used to judge the minimum spacing between arranged views.
- alignment - this property determines the layout of the arranged views perpendicular to the stack view’s axis
- isBaselineRelativeArrangement - this property is used to calculate the vertical spacing between views from baselines.
Thanks.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Gunjan Gumber
Gunjan is a bright IOS developer with good knowledge in Swift ,Json, quite good at building user interface.