Reputation: 931
I've got redesign for couple of screens on iPad. I gave a lot of thought and can't pick the best solution (or better) for laying out views. Screens are portrait and landscape orientation. 4 views should be layed out in a row if it's in landscape and 2 by 2 if they are in portrait.
I wanted to hear your opinion how would you takle this:
1) all on storyboard
2) part in storyboard part in code
3) all in code (I think this is simplest solution, but adds more (plausibly) unneeded code)
Thoughts?
Upvotes: 0
Views: 60
Reputation: 409
Assuming these are Collection Views, I would create two subclasses of UICollectionViewLayout: one for portrait, and one for landscape. Here's a handy tutorial for doing so by Ray Wenderlich. If you're not using a Collection View, I recommend it if your views are similar to each other.
Upvotes: 1
Reputation: 100503
A solution would be a collection with flow layout , and change it's height according to the current orientation that fits for 2 items (in height) in portrait and one item in landscape by adjusting itemSize
Upvotes: 1