How to use AutoLayout to position UIButtons in horizontal lines (wrapping, left aligned)?

后端 未结 3 1947
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-25 14:40

I need to create a couple of UIButtons with various widths programmatically in my app (iOS 6.0 and above).

I want to display the buttons in a \"wrap around\" style:

3条回答
  •  心在旅途
    2020-12-25 15:37

    Instead of using Autolayout, you could just use a collection view which better options for you to lay out elements such as buttons.

    It is better able to handle layouts under rotation as well.

提交回复
热议问题