Skip to content

Instantly share code, notes, and snippets.

@JigarM
Forked from mauropm/app.js
Created April 8, 2013 08:57
Show Gist options
  • Save JigarM/5335325 to your computer and use it in GitHub Desktop.
Save JigarM/5335325 to your computer and use it in GitHub Desktop.
/*
* An example of how to clean a window
* Mauro Parra-Miranda
* [email protected]
*/
var win = Ti.UI.createWindow();
var view = Ti.UI.createView();
var label = Ti.UI.createLabel();
var label2 = Ti.UI.createLabel();
var image = Ti.UI.createImageView({
url:'KS_nav_ui.png',
});
var view2 = Ti.UI.createView();
view2.add(label);
view2.add(label2)
view.add(view2);
view.add(image);
win.add(view);
win.open();
function do_clean(e,c){
clean(c);
e.remove(c);
Ti.API.info( 'Deleted child at do_clean' );
return;
}
function clean(e){
if (e!=null){
if(e.children){
Ti.API.info( 'Number of children: ' + e.children.length );
for(var i = 0; i<e.children.length;i++){
do_clean(e, e.children[0]);
}
} else {
return;
}
}
}
clean(win);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment