I have 4 label. so on landscape view i want 4 Label in single row but for portrait view I want to display 2 label in 1 row and another 2 table in next row. I am trying to achieve it with the help of UIStackView. but on portrait mode, it is displaying 4 labels in single row by adjusting their widths. So How Could I achieve it.
Asked
Active
Viewed 139 times
0
-
That is more of a task for a `UICollectionView` than a `UIStackView`. – DonMag Jun 15 '17 at 14:14
-
This task is already inside a table view cell which contain other data as well. – user1960279 Jun 15 '17 at 14:25
-
`UIStackView` arranges subviews either Horizontally or Vertically - it has no "wrap to another row" functionality. `UICollectionView` has *exactly* that capability. There are many discussions, examples and tutorials related to what you're trying to do - specifically, display "1 row / 4 columns" in landscape orientation and change to "2 rows / 2 columns" in portrait. Here is a good place to start: https://stackoverflow.com/questions/14674986/uicollectionview-set-number-of-columns (and yes, you can embed a Collection View in a table view cell) – DonMag Jun 15 '17 at 14:43
-
I can not add collection view inside tableview cell, because design is already complicated and also this is a expand collapse cell – user1960279 Jun 15 '17 at 14:53