Table View + iOS 7

I’m trying to use table view to list some remote images. The problem is: It appears that when the user scrolls the table, the rows which are not on the screen, are removed. When this happens, and the download isn’t completed, I am not able to check if the row stills on the screen, then, when the download is completed, the image appears on the wrong place, and I get an error for trying to insert the image on the nil row. This happens on iOS 7! On the iOS 6 version of Corona everything works fine.

Is there any way (or event) to stop the request when the row is removed from the scene?

Hi Bruno,

I had the same issue as well.  What I did was to check if the row exists after the networkListener phase has ended.  The network listener function is within the onRowRender tableview function.

[lua]

local function networkListener( event )

     if event.phase == “ended” then

          if row.y then

               row.mainimage =display.newImageRect(row,event.response.filename, event.response.baseDirectory,100,100 )
               row.mainimage.x = 22
               row.mainimage.y = 20

          end

     end

end

[/lua]

You might want to do a check within the onRowRender function to see if the file has previously been downloaded first, before calling networkDownload, as it will try to download the file each time the row appears on screen otherwise.

Hi Icy Spark,

thanks for your answer! : )
I’d already tried something similar to that, but it did not work : /
Maybe I should try the same but using network.download instead of display.loadRemoteImage, and of course, checking if the file already exists before making the download request.

I’ll do these changes and come back here!

I had to make some more changes other than use network.download!
Use row.y on the validation test really helped me. Before I was using just “if row then”.

Hi Bruno,

I had the same issue as well.  What I did was to check if the row exists after the networkListener phase has ended.  The network listener function is within the onRowRender tableview function.

[lua]

local function networkListener( event )

     if event.phase == “ended” then

          if row.y then

               row.mainimage =display.newImageRect(row,event.response.filename, event.response.baseDirectory,100,100 )
               row.mainimage.x = 22
               row.mainimage.y = 20

          end

     end

end

[/lua]

You might want to do a check within the onRowRender function to see if the file has previously been downloaded first, before calling networkDownload, as it will try to download the file each time the row appears on screen otherwise.

Hi Icy Spark,

thanks for your answer! : )
I’d already tried something similar to that, but it did not work : /
Maybe I should try the same but using network.download instead of display.loadRemoteImage, and of course, checking if the file already exists before making the download request.

I’ll do these changes and come back here!

I had to make some more changes other than use network.download!
Use row.y on the validation test really helped me. Before I was using just “if row then”.