A solution to the problem was to have a copy of each image outside the list and the screen to get better performance.
Test the code below with some high resolution images and with and without img2
[code]
print();print("");print()
– require controller module
local widget = require “widget”
– The main group
mainGroup = display.newGroup()
– The main function
local function main()
local function onRowRender( event )
local group = event.view
local row = event.target
local index = event.index
local id = event.id
text[index] = display.newText( "Row "…index, 100, 0, “HelveticaNeue”, 18 )
text[index]:setReferencePoint( display.CenterLeftReferencePoint )
text[index].y = row.height -75
text[index].x = 150
text[index]:setTextColor( 0 )
img[index] = display.newImage(“image”…index…".jpg")
img[index]:setReferencePoint( display.CenterLeftReferencePoint )
img[index].xScale = 100/img[index].width
img[index].yScale = 150/img[index].height
img[index].x = 10
img[index].y = row.height - 75
–Try uncommenting the code below
–[[img2[index] = display.newImage(“image”…index…".jpg")
img2[index]:setReferencePoint( display.CenterLeftReferencePoint )
img2[index].xScale = 100/img2[index].width
img2[index].yScale = 150/img2[index].height
img2[index].x = 200
img2[index].y = row.height - 75 --]]
– must insert everything into event.view:
group:insert(img[index])
group:insert(text[index])
end
local function createList()
local listOptions = {
top = 200,
width = 640,
}
_G.myList = widget.newTableView( listOptions )
_G.row = {}
_G.text = {}
_G.img = {}
_G.img2 = {}
topbar = display.newRect(0,0,640,200)
topbar:setFillColor(0,0,250)
for i=1, 3 do
local rowHeight = 150
– function below is responsible for creating the row
myList:insertRow{
id = “unique-row-” … i,
onRender = onRowRender,
onEvent=onRowTouch,
height = 150
}
end
end
createList()
myList.isVisible = true
return true
end
main()
[/code] [import]uid: 24111 topic_id: 25364 reply_id: 102452[/import]