widgets/switchfield/views/widget.xml
<Alloy>
<TableViewRow id="container">
<Label id="label"/>
<Switch id="switchControl" onChange="change"/>
</TableViewRow>
</Alloy>| var styles = require('styles'); | |
| // creates { color: 'blue', font: { fontSize: 16 }, textAlign: 'right' } | |
| var usernameLabel = Ti.UI.createLabel(_.defaults({ | |
| textAlign: 'right' | |
| }, styles.style_classes.Label, styles.style_ids.username_label)); |
| var webgl = require('appersonlabs.webgl'); | |
| var win = Ti.UI.createWindow({ | |
| backgroundColor:'#ccc' | |
| }); | |
| var canvas = webgl.createCanvasView({ | |
| height: Ti.Platform.displayCaps.platformHeight, | |
| width: Ti.Platform.displayCaps.platformWidth, | |
| backgroundColor: 'white' |
widgets/switchfield/views/widget.xml
<Alloy>
<TableViewRow id="container">
<Label id="label"/>
<Switch id="switchControl" onChange="change"/>
</TableViewRow>
</Alloy>| var toolbar = Ti.UI.iOS.createToolbar({ | |
| bottom: 0, | |
| left: 0, | |
| right: 0, | |
| width: Ti.UI.FILL, | |
| barColor: 'transparent', | |
| translucent: true, | |
| backgroundGradient: { | |
| type: 'linear', | |
| colors: [ |
| // semi-contrived example: adding a count() function to SQL collections which doesn't | |
| // load all of the models. | |
| // Alloy/lib/alloy/sync/sql.js | |
| function Count() { | |
| var table = model.config.adapter.collection_name; | |
| var sql = 'SELECT * FROM '+table; | |
| var rs = db.execute('SELECT COUNT(*) FROM '+table); | |
| return rs.isValidRow() ? rs.field(0) : 0; |
| var client = require('couch_client').CouchClient('http://foo.iriscouch.com'); | |
| var db = client.database('mydb'); | |
| db.create(); // if not already created | |
| var document = { | |
| x: 10, | |
| y: 'some string', | |
| foo: [1, 2, 3] | |
| }; |
| var server = require('com.obscure.titouchdb'), | |
| db = server.databaseNamed('mydb'); | |
| var doc = db.untitledDocument() | |
| var result = doc.putProperties({ | |
| foo: 10, | |
| bar: 'a string', | |
| x: [1,2,3,4] | |
| }); |
| { | |
| "_id": "_design/configs", | |
| "_rev": "4-a0b96a31984e1267e6ecf46302744451", | |
| "views": { | |
| "subnet": { | |
| "map": "function(doc) {\n emit(null, doc);\n};" | |
| } | |
| }, | |
| "lists": { |
| function ApplicationTabGroup(Window) { | |
| var MusicWindow = require('ui/handheld/MusicWindow'), | |
| VideosWindow = require('ui/handheld/VideosWindow'), | |
| SearchWindow = require('ui/handheld/SearchWindow'); | |
| //create module instance | |
| var self = Ti.UI.createTabGroup(); | |
| //create app tabs | |
| var win1 = new MusicWindow(L('music')), |
| // https://jira.appcelerator.org/browse/TIMOB-3132 | |
| function FORCE_LINKER() { | |
| Ti.UI.createWindow(); | |
| Ti.UI.createTab(); | |
| Ti.UI.createTabGroup(); | |
| Ti.UI.createProgressBar(); | |
| Ti.UI.create2DMatrix(); | |
| Ti.UI.createAnimation(); | |
| Ti.UI.iOS.createToolbar(); | |
| Ti.UI.iPhone.createNavigationGroup(); |