Skip to content

Instantly share code, notes, and snippets.

@minhnc
Created December 28, 2011 10:55
Show Gist options
  • Save minhnc/1527558 to your computer and use it in GitHub Desktop.
Save minhnc/1527558 to your computer and use it in GitHub Desktop.
Titanium UI Components
var win = Ti.UI.createWindow({
backgroundColor:'#BABABA'
});
var ui = require('modules/ui-min'),
progressBar = new ui.progressBar(
{width: 300, height: 27, backgroundImage: 'assets/images/full_bar.png'},
{backgroundImage: 'assets/images/bar.jpg', borderRadius: 3},
{font: {fontFamily: 'Arial', fontSize: 15, fontWeight: 'bold'}, color: '#fff'}
);
progressBar.init('Uploading photo...');
win.add(progressBar.view);
win.open();
// Use interval to update the progress each second
var percent = 0;
var interval = setInterval(function() {
if ( percent >= 100 ) {
clearInterval(interval);
progressBar.finish();
return;
}
percent += 10;
progressBar.run(
'Uploading photo... ' + percent.toString() + '%',
percent
);
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment