Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to layout a table with equal cell height and width? #27

Open
horaceho opened this issue Dec 14, 2015 · 2 comments
Open

How to layout a table with equal cell height and width? #27

horaceho opened this issue Dec 14, 2015 · 2 comments
Labels

Comments

@horaceho
Copy link

Give a resizable UIView, what is the proper way to layout a 3 x 4 table with equal width and height for each cell?

For example, when the view is 120 x 120, each cell is 40 x 30. When the view is resize to 240 x 360, each cell changes to 80 x 90.

@cactis
Copy link

cactis commented Feb 20, 2016

maybe such as....

if a is a resizable view

add r1 view to a
add r1c1, r1c2, r1c3 to r1

add r2 view to a and r2c1, r2c2, r2c3 ....
add r3 view to a and r3c1, r3c2, r3c3....

and groupAndFill them....
a.groupAndFill(group: .Vertical, views: [r1, r2, r3], padding: 0)
r1.groupAndFill(group: .Horizontal, views: [r1c1, r1c2, r1c3], padding: 0)
r2.groupAndFill(group: .Horizontal, views: [r2c1, r2c2, r2c3], padding: 0)
r3.groupAndFill(group: .Horizontal, views: [r3c1, r3c2, r3c3], padding: 0)

@tim12s
Copy link
Contributor

tim12s commented May 20, 2016

I dont mind looking at this, i'm looking for something similar allowing certain "cells" to be merged and then have the cell layout altered once the handset/device is rotated. E.g. 3x4 vs 4x3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants