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 they fit within their container view.
In landscape mode, this UIScrollView should scroll horizontally, in portrait mode, it should scroll vertically.
I'm trying to make an ScrollView similar to the "Featured" tab in the iPad YouTube app. Landscape has 4 columns, portrait: 3 columns, "Subscriptions" tab, portrait, the same view has 2 columns.
I have implemented a layout system to do things like this. There is a demo project on how to use it checked into that repository. I'd be happy to answer any questions about it. This is much more lightweight than AQGridView, so if you don't need the extra functionality he is providing, I would recommend an approach similar to mine.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With