iOS Dev Nugget 146 UIStackView and TZStackView


Need to run a code review on your codebase? Hire me

iOS 9 adds UIStackView (and OS X 10.9 introduced the similar NSStackView), which makes it easier to use Auto Layout, reducing the need to create NSLayoutConstraints. In practice, you may still need to create a couple of constraints when you use UIStackView. These constraints usually has less to do with positioning views, but more for keeping them at the correct dimensions, notably for views that don't return a good value for -intrinsicContentSize.

It is really nice for layout and you really should start using it as soon as you can. Most of us wouldn't be able to support a minimum deployment target of iOS 9 any time soon, but there's a wonderful clone of UIStackView called TZStackView that you can use in place of UIStackView. It supports the same API. The only downside is TZStackView doesn't support Storyboards.

Check it out.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No



Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues