Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Last active January 6, 2018 03:55
Show Gist options
  • Save arturoleon/3724659 to your computer and use it in GitHub Desktop.
Save arturoleon/3724659 to your computer and use it in GitHub Desktop.
Loading window for Titanium Mobile
//Usage example
var win = Ti.UI.createWindow();
var loadingWindow = require('LoadingWindow')();
win.add(loadingWindow);
//win.remove(loadingWindow)
win.open();
function loadingWindow(msg){
if(msg === undefined) var msg = 'Cargando';
//loading window for iOS (not tested in Android)
var self = Titanium.UI.createView({
height:90,
width:120,
backgroundColor:'#000',
borderRadius:10,
opacity:0.8,
touchEnabled:false
});
var actInd = Titanium.UI.createActivityIndicator({
top:8,
height:50,
width:50,
style:Titanium.UI.iPhone.ActivityIndicatorStyle.BIG
});
var message = Titanium.UI.createLabel({
text:msg,
color:'#fff',
textAlign:'center',
font:{fontSize:18,fontWeight:'bold'},
height:'auto',
width:'auto',
top:'55'
});
actInd.show();
self.add(actInd);
self.add(message);
return self;
}
module.exports = loadingWindow;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment