Hi there,
I am trying to achieve the following:
I load a list of items from a remote server, and I show 5 of them in a scrollview. There are many more of the same item on the server, but I want to load them, only if the user reaches the bottom of the screen by scrolling.
I want this to continue for ever, aka, as long as the user scrolls down, a new set of 5 items is loaded and added to the bottom of the page.
I have managed to add an item to the bottom of the page when the user scrolls doing the following inside the scrollview listener
if event.limitReached then if "up" == direction then print( "Reached Top Limit" ) local myOwnItem = display.newRect(2, currentEndOfMyContent, 300, 100) myOwnItem:setFillColor(255, 0, 0) event.target:insert(myOwnItem) elseif "down" == direction then print( "Reached Bottom Limit" ) elseif "left" == direction then print( "Reached Left Limit" ) elseif "right" == direction then print( "Reached Right Limit" ) end end
But I havent managed to make the scrollview expand, so the screen never remains on the last item that I just added.
Is there a way to expand the scrollview after it has been made?
The documentation says :
scrollWidth, scrollHeight (required)
Numbers. This is the width/height of the total scrollable content area. This cannot be changed after the ScrollView widget has been created.
Does this means that what I am trying to do is not doable with newScrollView?