scrollView iPhone

You must Login before you can answer or comment on any questions.

Hi,

I have a problem.

i have a scrollView and i want to empty it before loading its content especially when i refresh it.

i have : scrollPhotos and i tried scrollPhotos.children = [] whithout result.

can anyone help me please.

thank you

1 Answer

Accepted Answer

Hi Djamel

How about using a quick and dirty (but legit) technique.

Add your scrollview as normal, add a normal view inside the scrollview, set this with any layout property you may have set the scrollview - key though is declare this view as a variable you can refer to later.

Then add all your normal child elements to the internal view.

When you want to clean up call;

scrollview.remove(normalview);
This will remove everything without having to worry about how.

You cn add this in any style of code you are using, but an external clean function exposed from a CommonJS file will be the cleanest, as the scope is handled.

Cheers

— answered 11 months ago by Malcolm Hollingsworth
answer permalink
1 Comment
  • it works :) thanks...

    i wrote :

    for(var i=0; i< scrollPhotos.children.length; i++){
                scrollPhotos.remove(scrollPhotos.children[i]);
            }
    but i know it is dirty method.

    thanks

    — commented 11 months ago by Djamel ZAHAL

Your Answer

Think you can help? Login to answer this question!