Read more at http://fokkezb.nl/2013/10/07/dynamic-menu-for-tab-groups/
Ti.include('utils.js'); | |
// Base window | |
var win = Ti.UI.createWindow(); | |
// Base launch button | |
var button = Ti.UI.createButton({ | |
title:'Press here', | |
top: 10, | |
left: 10, |
open -a Google\ Chrome\ Canary --args --disable-web-security |
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW | |
var headerView = Ti.UI.createView({ | |
backgroundColor:'#fff', | |
height:80, | |
layout:'horizontal' | |
}); | |
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'})); | |
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'})); |
Here's an example of how to embed a Gist on GitHub Pages:
{% gist 5555251 %}
All you need to do is copy and paste the Gist's ID from the URL (here 5555251
), and add it to a gist
tag surrounded by {%
and %}
.
var win = Titanium.UI.createWindow(); | |
var scanner = Titanium.UI.createView({ | |
width : 260, | |
height : 200, | |
borderColor : 'red', | |
borderWidth : 5, | |
borderRadius : 15 | |
}); |
If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.
Well, you can:
var _ = require((typeof ENV_TEST === 'boolean') ? 'alloy' : 'underscore')._;
The above works by utilizing Alloy's optimization process. In this process, constants like ENV_TEST
will be either TRUE
or FALSE
. The actual expressions in wich they are used will then be evaluated. If FALSE
the code block will be removed. In plain Titanium projects the constants are undefined and this typeof ENV_TEST
will be undefined
, so the code block will be executed.
The ADB excecutable lives in: | |
[path-to-android-sdk]/platform-tools/ | |
./adb -e logcat | grep TiAPI | |
or | |
./adb -d logcat | grep TiAPI |
// setup geolocation purpose and accuracy | |
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST; | |
Ti.Geolocation.purpose = L('geo-purpose'); | |
// setup map and poi's annotation | |
var latitude = 48.847684, | |
longitude = 2.35165; | |
var annotation = Titanium.Map.createAnnotation({ | |
animate: true, |
var flattenObject = function(ob) { | |
var toReturn = {}; | |
for (var i in ob) { | |
if (!ob.hasOwnProperty(i)) continue; | |
if ((typeof ob[i]) == 'object') { | |
var flatObject = flattenObject(ob[i]); | |
for (var x in flatObject) { | |
if (!flatObject.hasOwnProperty(x)) continue; |