Search code examples
iosobjective-clayoutwatchkitapple-watch

Apple Watch (WatchKit) layout style library for iOS


Layout for Apple Watch is based on placing objects to storyboard. Every new object is placed just under the previous one etc. There is also possible to use groups and align objects same way horizontally. (see details here) I would appreciate to have the same functionality on iOS - to place UIViews this way and define them same attributes like alignment, width relative to container etc. just like in WatchKit.

It is also similar with LinearLayout on Android. I found CSLinearLayoutView on github, but its very old and it doesn't use autolayout.

Does any good library for this purpose exist?

If not.. It looks very easy to implement this by myself, do you see any key problems or limitations which would make it impossible?


Solution

  • Introduced in iOS 9 as UIStackView - https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIStackView_Class_Reference/

    Custom UIStackView implementation for iOS 7+ https://github.com/oarrabi/OAStackView