I have one .js file with a window and then I add all my layouts to this window.
first.js
var Win = Ti.UI.CreateWindow({
backgroundColor : 'white'
});
Win.open();
secun.js
var View = Ti.UI.createView({
height : Ti.UI.SIZE,
width : deviceWidth,
backgroundColor : 'white'
});
Ti.UI.CurrentWindow.add(View);
var label = Ti.UI.createLabel({
text : "Test",
color : 'white',
height : deviceHeight * 0.090,
width : deviceWidth,
backgroundColor : 'transparent',
textAlign : 'center',
font : {
fontSize : deviceHeight * 0.0285,
fontWeight : 'normal'
}
});
View.add(label);
To remove the View I make as follow:
Ti.UI.CurrentWindow.remove(View);
When I due this, the memory occupied by the View and label are released or is it necessary to doe something else to release the phone memory? Like setting variables to null so the are no longer associates do Ti object and can be cleaned by the garbage collector?
The problem of seething variables to null in my project relays in the fact that some variables are created inside functions and then are not available outside that function.
Aucun commentaire:
Enregistrer un commentaire