This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Ever wondered how to get the nice column of letters in the right side | |
* of the table view? | |
* | |
* Here is an example: | |
* 1. We take a list of names from a json file | |
* 2. We need to sort them by either first name or last name | |
* 3. We need to create a row header once in a while, when the first letter changes | |
* 4. We need to create a table index | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inspired on http://www.joelpeterson.com/clock/ | |
// and most of the code taken from there as well | |
var win = Ti.UI.createWindow({ | |
orientationModes: [3, 4] | |
}); | |
var clock_bg = Ti.UI.createView({ | |
backgroundColor: '#444444', | |
top: 20, | |
left: 20, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
backgroundColor:'#fff' | |
}); | |
var webView = Ti.UI.createWebView({ url:'http://www.appcelerator.com', scalesPageToFit:true,setZoomScale:2, top:0, left:0}); | |
win.add(webView); | |
var firstTime = true; | |
var htmlHack = ''; | |
htmlHack += 'var element = document.createElement("meta");'; | |
htmlHack += 'element.name = "viewport";'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var iconStore = Ti.Filesystem.applicationDataDirectory + '/CachedRemoteImages'; | |
var dir = Ti.Filesystem.getFile(iconStore); | |
if (!dir.exists()) { | |
dir.createDirectory(); | |
} | |
function cacheRemoteURL(image, imageURL) { | |
if (imageURL) { | |
var hashedSource = Ti.Utils.md5HexDigest(imageURL + '') + '.' + imageURL.split('.').pop(); | |
var localIcon = Ti.Filesystem.getFile(iconStore, hashedSource); | |
if (localIcon.exists()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
title:'table', | |
}); | |
var table = Ti.UI.createTableView({}); | |
win.add(table); | |
var oldRow = {}; | |
function swipe(a,b,c){ | |
// a = view |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor:'#ccc' | |
}); | |
// create the table view | |
var tableView = Ti.UI.createTableView({}); | |
// create an empty array | |
var data = []; | |
// this is the alert message + deleting the row from the array | |
function confirmDel(rowId,rowName) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow(); | |
function view(img){ | |
var image = Ti.UI.createImageView({ | |
url:img | |
}); | |
return image; | |
} | |
var scrollable = Ti.UI.createScrollableView({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timetest = new Date(); | |
// TEST ONE WITH PROTOTYPE | |
// function User() {} | |
// for(var i = 0; i < 50000; i++) { | |
// User.prototype[i] = {}; | |
// } | |
// TEST TWO Module Pattern |