Skip to content

Instantly share code, notes, and snippets.

@dawsontoth
Created May 10, 2011 14:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dawsontoth/964526 to your computer and use it in GitHub Desktop.
Save dawsontoth/964526 to your computer and use it in GitHub Desktop.
Loading images in @appcelerator #Titanium
/* The images for this example can be downloaded from http://j.mp/loadingimagesforti */
var win = Ti.UI.createWindow({ backgroundColor: '#f00'});
var loading = Ti.UI.createImageView({
images: [
'images/loading/00.png', 'images/loading/01.png', 'images/loading/02.png',
'images/loading/03.png', 'images/loading/04.png', 'images/loading/05.png',
'images/loading/06.png', 'images/loading/08.png', 'images/loading/09.png',
'images/loading/10.png', 'images/loading/11.png'
],
width: 33, height: 33
});
loading.start();
win.add(loading);
win.open();
@dawsontoth
Copy link
Author

You might say, "Why not use an activity indicator?" That works fine on iOS. But on Android a modal alert pops up and blocks the user from interacting with the app! If you use the above sample instead of an activity indicator, you can deliver the same experience to both platforms, and you aren't so intrusive on Android.

@dawsontoth
Copy link
Author

I just updated the sample images (it's a zip) to have retina images as well. I made these images, so there aren't any royalty issues to face. Use the images at your own risk, don't sue me, yada yada yada.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment