Hello,
I am trying to make spacing between rectangles equal in my app. The height of the rectangles depends on the content, which changes, so I don’t know the exact height
here is what I have so far:
[lua]–titles and paragraphs are tables with entries - each one has 15 entries
local y = 100
for i=1,#photos do
local r = display.newRect(0,0,0,0)
local t = display.newRetinaText(titles[i],0,0,280,0,native.systemFontBold,15)
local p = display.newRetinaText(paragraph[i],0,0,280,0,native.systemFont,15)
local w = display.newImage(“photo” … i … “.png”, system.TemporaryDirectory)
if w.width > 300 then
w.xScale = 0.4
w.yScale = 0.4
if w.width > 300 then
w.xScale = 0.4
w.yScale = 0.4
end
end
t:setTextColor(0,0,0)
p:setTextColor(0,0,0)
w.x=display.contentWidth*0.5
r.width=300
r.height=t.height + p.height + w.contentHeight + 50
r.x=display.contentWidth*0.5
r.y=y
t.x=display.contentWidth*0.5
t.y=(r.y - r.contentHeight*0.5) + t.contentHeight*0.5 + 10
p.x=display.contentWidth*0.5
w.y=(r.y - r.contentHeight*0.5) + t.contentHeight + w.contentHeight*0.5 + 20
p.y = r.y + w.contentHeight*0.5 + 40
scrollView:insert®
scrollView:insert(t)
scrollView:insert§
scrollView:insert(w)
y = y + (r.y + r.contentHeight*0.5 ) + 50 – here i try to find the bottom part of the rectangle and go down 20 pixels, but this just isn’t happening
end[/lua]
any help with this would be greatly appreciated!
Thanks [import]uid: 24641 topic_id: 21981 reply_id: 321981[/import]