LGStackView – Swift iOS8 control similar to UIStackView

lgstackview-logoLGStackView is a control that is a simplified version of UIStackView supporting iOS8. It is used to stack dynamic subviews constrained with autolayout constraints in Interface Builder based on their hidden or alpha property. Once the constraints are set up for all views, there are two IBInspectable properties in Interface Builder to set up. First is the orientation (vertical/horizontal), and the seconds is padding among views. The order of the views is determined by their z index, which is set by reordering subviews list in Interface Builder.

Once the hidden or alpha property is changed, invalidateLayout method should be called to arrange constraints. Only horizontal/vertical constraints between views are modified. Constraints change can be animated:

The code is available on GitHub: https://github.com/lukagabric/LGStackView

If you liked this blog post I’d appreciate if you followed me on Twitter

Related Post

Remember to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *