This file contains 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: 'black' } | |
); | |
var center1 = {'x': 100, 'y':100}; | |
var center2 = {'x': 100, 'y':250}; | |
var lastIndex = 1; | |
var background = Ti.UI.createView({ backgroundColor:"#444444", }); | |
var view = Ti.UI.createView({ backgroundColor:'red', center:center1, width:100, height:100, zIndex:lastIndex++, }); | |
var view2 = Ti.UI.createView({ backgroundColor:'green', center:center2, width:100, height:100, zIndex:lastIndex, }); | |
background.addEventListener('touchstart', function(e){ |
This file contains 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 newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir'); | |
Ti.API.info("Created mydir: " + newDir.createDirectory()); | |
Ti.API.info('newdir ' + newDir); | |
var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt'); | |
if(newFile.exists()){ | |
newFile.write("I should be backed up!"); | |
newFile.remoteBackup = true; | |
//or we can set the whole folder to be iCloudable | |
//newDir.remoteBackup = true; | |
} |
This file contains 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: 'red' }); | |
var md5 = Ti.Utils.md5HexDigest(win.toImage()); | |
var label = Ti.UI.createLabel({ | |
text:md5 | |
}); | |
win.add(label); | |
win.open(); |
This file contains 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:'#fff' | |
}); | |
var view = Ti.UI.createImageView({ | |
height: 200, | |
backgroundColor:'#f00' | |
}) | |
win.add(view); |
This file contains 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:'#fff' | |
}); | |
var view = Ti.UI.createImageView({ | |
height: 200, | |
backgroundColor:'#f00' | |
}) | |
win.add(view); |
This file contains 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
/** | |
* A singleton object | |
* | |
* Singleton objects are useful but use them sparingly. By using singletons | |
* you are creating dependencies in your software that might not be necessary. | |
* If you find yourself using this over and over again you probably need | |
* to rethink what you're doing. Remember, in general, globals are bad. | |
*/ | |
var Preferences = { | |
fbToken: '1234', |
This file contains 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(); | |
var label1 = Ti.UI.createLabel | |
({ | |
text:'Some Documents listed', | |
font:{fontWeight:'bold', fontSize:14}, | |
color: '#8c0000', | |
height: 'auto', | |
left: 10, | |
top:10 |
This file contains 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
-------content of app.js-------- | |
Ti.include('somefolder/platform.js'); | |
Ti.include('somefolder/API.js'); | |
Ti.include('somefolder/modules.js'); | |
Ti.include('somefolder/UI.js'); | |
MyApp = { | |
Platform:{}, | |
API:{}, | |
Modules:{}, |
This file contains 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 lineItemsSection = Ti.UI.createTableViewSection({ | |
headerView : lineItemsHeaderView | |
}); | |
var rows = []; | |
for(var i = 0; i < itemCount; i++) { | |
var tableViewRow = Ti.UI.createTableViewRow({ | |
id : "lineItemDetails", | |
data : data[i], |
This file contains 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
/** | |
* Global singleton | |
*/ | |
var APP = { | |
/** | |
* This sets up global events, persistant things | |
* throughout the app, etc. Only should be called | |
* when the app is booted. | |
*/ |
OlderNewer