Rob , you are right !!!
I build another code due to my carelessness :blink: !!!!!!!!!!!!!
Thanks again for your warm-hearted help and bearing with my poor english ~~~~~
Thnk you :D !!!
Rob , you are right !!!
I build another code due to my carelessness :blink: !!!!!!!!!!!!!
Thanks again for your warm-hearted help and bearing with my poor english ~~~~~
Thnk you :D !!!
Hi~~~ i have problems about insert many images (obtained by display.loadRemoteImage ) in tableview 
I want to download and show images in onRowRender function but when i slip slightly the image in the corresponding line will disappeared or not(i dont know the reason···)
The following code is my code
local filename={} local news = {} news[1] = {} news[1].url = "http://www.1000eyes.com/img/1/1/4/2013031510000004\_2.jpg" news[2] = {} news[2].url = "http://www.1000eyes.com/img/1/1/1/2013031510000002\_2.jpg" news[3] = {} news[3].url = "http://www.1000eyes.com/img/1/1/45/2013031510000010\_2.jpg" news[4] = {} news[4].url = "http://www.1000eyes.com/img/1/1/58/2013031510000009\_2.jpg" local listOptions = { top = 200, left = 0, width = display.contentWidth, height = 600, bgColor = {50,50,100} } --list myList = widget.newTableView( listOptions ) -- onRender listener for the tableView local function onRowRender( event ) local row = event.target local rowGroup = event.view index = event.index filename[index] = event.index local function networkListener( event ) if ( event.isError ) then print ( "Network error - download failed" ) else local img = event.target rowGroup:insert(img) end end display.loadRemoteImage( news[event.index].url, "GET", networkListener, filename[event.index] .. ".png", system.DocumentsDirectory, 0, 0 ) end local mask1 = display.newRect(0,0,display.contentWidth,200) mask1:setFillColor(255,0,0) local mask2 = display.newRect(0,listOptions.top + listOptions.height,display.contentWidth,500) mask2:setFillColor(0,255,0) for i=1, #news do myList:insertRow{ id = i, onRender = onRowRender, height = 300 } weburl = news[i] end
Thanks
Trial build 971
Hi , Rob i am a new user of Corona ~~~
So is there logical or syntax error in code? :wacko:
Thanks!!!
Are you getting any errors printed in your terminal? I don’t see any obvious errors.
No , no error
And the following picture show the display error in simulator
when i slip slightly between image3 and image4 the image3 are disappeared
You seem to be setting a custom height of 600 px for the table view. If you are not using the full screen, you need to create a mask file and apply it to get things to display right. Try taking out the height = 600 for now and see if changes anything.
But Rob, I modify the code but new error occurred
widget = require "widget" local bg = display.newRect(0,0,display.contentWidth,display.contentHeight) bg:setFillColor(100,100,0) local listOptions = { top = 100, left = 0, width = display.contentWidth, height = 180\*2,--600, bgColor = {50,50,100} } myList = widget.newTableView( listOptions ) -- onRender listener for the tableView local function onRowRender( event ) local row = event.target local rowGroup = event.view local rowW = row.width local rowH = row.height index = event.index local function networkListener( event1 ) if ( event.isError ) then print ( "Network error - download failed" ) else event1.target:setReferencePoint(CenterReferencePoint) event1.target.width = 160 event1.target.height = 160 rowGroup:insert(event1.target) end end display.loadRemoteImage( "http://developer.anscamobile.com/demo/hello.png", "GET", networkListener, "helloCopy"..index..".png", system.TemporaryDirectory, 0, 0 ) end for i=1, 5 do myList:insertRow{ id = i, onRender = onRowRender, height = 180--300 } end --top mask fo list local masktop = display.newRect(0,0,display.contentWidth,listOptions.top) masktop:setFillColor(255,255,255) --bottom mask local maskbottom = display.newRect(0,listOptions.top + listOptions.height,display.contentWidth,180) maskbottom:setFillColor(255,255,255)
When i scroll from top to bottom (or from bottom to top) largely there will be error as below:
Runtime error (line 33)
attempt to call method “insert” (a nil value)
what is line 33?
rowGroup:insert(event1.target) —— this line
when i insert image in rowGroup (the “event.view” )
rowGroup.insert has become nil instead of being a function. This is likely a row that has scrolled off the screen that the downloader is trying to access.
Do this:
[lua]
if rowGroup and rowGroup.insert then
rowGroup:insert(event1.target)
end
[/lua]
and see if that helps
Thanks Rob 
Yes that works
But like you said when downloader trying to access happened after scrolling off the screen , the corresponding image will stay in screen all the time ~~~~~~
then add an “else” clause that removes event1.target.
Unfortunately the error also occurred 
I add the following code
if rowGroup and rowGroup.insert then
rowGroup:insert(event1.target)
else
event1.target:removeSelf()
event1.target =nil
end
Rob , you are right !!!
I build another code due to my carelessness :blink: !!!!!!!!!!!!!
Thanks again for your warm-hearted help and bearing with my poor english ~~~~~
Thnk you :D !!!