I’m just curious if this is just the way scrollview works or of it’s a corona limitation.
I’ve got a scrollview that I’m using as an image gallery, basically like the example in the corona business sample app . Although I modified the sample app to put all the thumbnails inside a scrollview.
I then added a button that loops through around 200 images and inserts those into scrollview. All local images inside the resource directory. When I hit the button to load the images into scrollview the app (or scrollview that is) just freezes and wont let me scroll until the images have all been loaded. I have also done this with simple display.newRect’s and it has the same hitching/freezing
Can scrollview not scroll while objects are being placed inside it? Is this a scrollview issue or is it something with how I’m coding?
Here’s the for loop I’m using to place images inside the scrollview:
for i = 1, #photoFiles do --[[this is the sample code for using newRect instead of memory heavy image photosThumbnails[i] = display.newRect( 0, 0, 80, 80 ) photosThumbnails[i].strokeWidth = 3 photosThumbnails[i]:setFillColor( 0.5 ) --]] photosThumbnails[i] = display.newImage(photoFiles[i]) local aspectRatio = photosThumbnails[i].width / photosThumbnails[i].height local scale if aspectRatio \> 1 then -- landscape photo scale = 80 / photosThumbnails[i].height else scale = 80 / photosThumbnails[i].width end photosThumbnails[i]:scale(scale,scale) photosThumbGroups[i] = display.newGroup() photosThumbnails[i].x = groupOffset --col \* 80 + 40 photosThumbnails[i].y = groupOffset --row \* 80 + 40 + 70 photosThumbGroups[i]:insert(photosThumbnails[i]) photosThumbGroups[i].x = col \* 80 + 40 photosThumbGroups[i].y = row \* 80 + 40 + 70 photosThumbGroups[i]:setMask(thumbnailMask) photosThumbGroups[i].maskX = groupOffset photosThumbGroups[i].maskY = groupOffset photosThumbGroups[i].index = i photosThumbGroups[i]:addEventListener("touch", showPhoto) col = col + 1 if col \> 3 then row = row + 1 col = 0 end scrollView:insert(photosThumbGroups[i])