Created
July 29, 2012 19:35
-
-
Save adelevie/3201323 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
width = 102 # width of rectangle | |
height = 40 # height of rectangle | |
pos_x = 3 # x coordinate for entire grid | |
pos_y = 3 # y coordinate for entire grid | |
y_margin = 3 # vertical space between rectangles | |
x_margin = 3 # horizontal space between rectangles | |
columns = 3 # number of columns | |
rows = 5 # number of rows | |
columns.times do |col| # number of columns | |
rows.times do |row| # number of rows | |
# frame = [[x,y], [width, height]] | |
# frame = [position of rectangle, size of rectangle] | |
frame = [[(col * width) + pos_x + (col * x_margin), (row * height) + pos_y + (row * y_margin)], [width, height]] | |
# adding the subview to the superview: | |
# v = UIView.alloc.initWithFrame(frame) | |
# view.addSubview(v) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment