Skip to content

Instantly share code, notes, and snippets.

@zashishz
Last active February 21, 2017 11:03
Show Gist options
  • Save zashishz/c7d63265f0ccbad000d97be912e42600 to your computer and use it in GitHub Desktop.
Save zashishz/c7d63265f0ccbad000d97be912e42600 to your computer and use it in GitHub Desktop.
Ti.API.(info/debug/error)('window');
Ti.App.fireEvent('changeBg',{newcolor: 'red'});
Ti.App.addEventListener('changeBg',function(a){'
view.backGroundColor = a.newcolor;
});
//e.source.whichObj
//saving JSON.XML Obj's //Saving Global Prop's /eg:OSname
Ti.Api.properties.setString/getString
//DATABASE
*INSTALL DB
var db = Ti.Database.install('/mydata/myDatabase','myDatabase');
*open cmd creates DB if not present:
var db = Ti.Database.open('myDB');
db.execute('query');
db.close();
//NETWORK - GET,POST,PUT - REST Services
Ti.Network.HTTPClient
var xhr = Ti.Network.createHTTPClient();
xhr.onload = function(e) {
//handke response
onload: function(){
},
onerror: function(){
},
timeout(5000);
}
xhr.open('POST',url);
xhr.send({
title: "Some val",
body:"Some body"
});
//ORIENTATION
Ti.Getsure.addEventListener('orientationchange',fn(){
});
get Orientation name
Ti.Gesture.orientation
=======BACK MENU NAVIGATION=======
var win = Ti.UI.createWindow({
background:'My Window',
title:"A"
});
var win2 = Ti.UI.createWindow({
background:'next Win',
title:"B"
});
var navWin = Titanium.UI.iOS.createNavigationWindow({
window:win
});
var navWin2 = Titanium.UI.iOS.createNavigationWindow({
window:win2
});
var btn = Ti.UI.createButton({
title:"POP",
top:50,
backgroundColor:"#65defa"
});
btn.addEventListener('click',function(e){
navWin.openWindow(win2, {animated: true});
});
win.add(btn);
navWin.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment