Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Add view to other view and be the first child

$
0
0

Hello everybody, I have a view that contains views. I want that when i add new view it will be the first child of the contain view(index 0) but evertything that i tried to do doesn't work. this is the last attempt:

//move object to array, insert the new one and return the other objects
        var moveChildren = [];
        for (var i = 0; i < mainView.length; i++) {
            moveChildren.push(mainView.children[i]);
        };
        mainView.removeAllChildren();
        //now insert the new one:
        mainView.add(lastSearchContainer);
        //and then return the other:
        for (var i = 0; i < moveChildren.length; i++) {
            mainView.add(moveChildren[i]);
        };
but when i remove from mainView it seems that it removed also from moveChildren array, because it's not deep copy. any suggestion..? Thank's!

Viewing all articles
Browse latest Browse all 8068

Trending Articles