Scrollview: shifting objects down

I’m trying to push all the entries in a vertical scroll view down, so I can insert a new item at the top. At the moment my code for doing so looks like:

[lua]

  local view=scrollView:getView()

  for i=1,view.numChildren do

     view[i]:translate(0,newGroup.height+padding)

  end

  scroll:insert(newGroup)

[/lua]

However when I do this, on the first run the new group item is shunted down almost offscreen, which is weird, because I don’t understand why the scrollview’s view would have any items or why shifting them down would cause an issue. 

On the second run, when there’s already a group that I’ve added in the scroll view, the scrolling above code seems to have no effect. 

Am I approaching this problem from the wrong angle? Any insights into how the scrollview works, where the objects I add to it are stored would be really useful. Thanks!

Could you paste sample code, got some free time so might find solution for you.

Thanks @drlinidon, I’ve actually fudged a solution in, which is to keep a separate list of the objects in the scroll view, independent of the view itself. 

Could you paste sample code, got some free time so might find solution for you.

Thanks @drlinidon, I’ve actually fudged a solution in, which is to keep a separate list of the objects in the scroll view, independent of the view itself.