float:left in objective-c

后端 未结 3 2050
执念已碎
执念已碎 2021-02-14 18:54

I\'m trying to make a bunch of buttons behave somewhat like float:left in CSS. So whenever the view changes size, on orientation change for example, the buttons should adjust so

3条回答
  •  醉话见心
    2021-02-14 19:45

    you might want to check out AQGridView, which is basically a re-implementation of Cocoa's NSCollectionView: https://github.com/AlanQuatermain/AQGridView

    Otherwise, you might need to override layoutSubviews in your parentView and then rearrange the subviews (buttons) accordingly when the dimensions of the parentView change.

    Cheers,

    Johannes

提交回复
热议问题