UIStackView 可以支持 iOS 8 或 7 吗?

Can UIStackView support iOS 8 or 7?

我知道 UIStackview 是 iOS 9 中的新功能。如果我希望我的应用程序支持 iOS 8 或 iOS 7,这是否意味着我不应该使用堆栈视图?

它看起来适合 iOS 9+。

UIStackView

Availability

Available in iOS 9.0 and later

UIStackView 仅适用于 "iOS 9.0 and later"。

如果您需要支持 iOS 的早期版本,请查看 OAStackView,这是 "implements most of the features from UIStackView" 并支持 iOS 7+ 的替代品。

一些小功能还没有完成。我用 UIStackView-Playground project 试了一下,效果很好。

你也可以查看 MarkupKit(我是项目作者):

https://github.com/gk-brown/MarkupKit

LMColumnViewLMRowView 类 与 UIStackView 非常相似,但可以与 iOS 8 一起使用。它们还有一些 UIStackView 没有,例如设置背景颜色和基于权重的分布的能力。

有关详细信息,请参阅本文:

https://gkbrown.wordpress.com/2015/09/29/using-uistackview-with-markupkit/

UIStackView 仅在 iOS 9+ 中受支持。 对于寻找向后移植到 iOS7/8 的人:

https://github.com/oarrabi/OAStackView