I’m trying to add one icon and one label to each of the tableView rows but instead of that I get att 5 Icons and labels in every cell on top of each other. What am I doing wrong?
going crazy…
Thanks
/C
[code]
local function onRowRender( event )
local row = event.target
local rowGroup = event.view
local iconTbl = {“firstIcon.png”, “secondIcon.png”,“thirdIcon.png”, “fourthIcon.png”, “fifthIcon.png”}
local labelTbl = {“first”, “second”, “third”, “fourth”, “fifth”}
local cellIcon = {}
local cellText = {}
local cellBg = display.newImageRect(rowGroup, “tableViewCellBg.png”, 320, 36);
cellBg:setReferencePoint(display.TopLeftReferencePoint);
cellBg.x = 0;
cellBg.y = 0;
for i = 1, #iconTbl do
cellIcon[i] = display.newImageRect(rowGroup, iconTbl[i], 18, 18);
cellIcon[i]:setReferencePoint(display.CenterLeftReferencePoint);
cellIcon[i].x = 10;
cellIcon[i].y = cellBg.height * 0.5;
end
for i = 1, #labelTbl do
cellText[i] = display.newEmbossedText(rowGroup, labelTbl[i], 0, 0, “Helvetica”, 16 )
cellText[i]:setReferencePoint( display.CenterLeftReferencePoint);
cellText[i].x = 38;
cellText[i].y = cellBg.height * 0.5;
cellText[i]:setTextColor(158, 162, 166, 255);
end
end
[/code] [import]uid: 65840 topic_id: 26312 reply_id: 326312[/import]
[import]uid: 65840 topic_id: 26312 reply_id: 106686[/import]