UPDATE: With the assets command of the TiCons CLI / Module this can be done even simpeler by calling $ ticons assets
or an alloy.ymk
using:
task("pre:load", function(event, logger) {
require('ticons').assets();
});
// MultiExporter.jsx | |
// Version 0.1 | |
// Version 0.2 Adds PNG and EPS exports | |
// Version 0.3 Adds support for exporting at different resolutions | |
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
// Version 0.5 Fixed cropping issues | |
// Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
// | |
// Copyright 2013 Tom Byrne | |
// Comments or suggestions to tom@tbyrne.org |
// For iOS7 only, set the window's top to 20 so they start under the status bar. | |
Alloy.Globals.windowTop = (OS_IOS && parseInt(Ti.Platform.version[0], 10) >= 7) ? 20 : 0; |
http://developer.android.com/guide/topics/resources/providing-resources.html#ScreenAspectQualifier | |
if ((Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.platformHeight) < (((Ti.Gesture.orientation === Ti.UI.LANDSCAPE_LEFT)) ? (320 / 240) : (240 / 320)))) { | |
Ti.API.info('I am LONG'); | |
} else { | |
Ti.API.info('I am NOTLONG'); | |
} |
UPDATE: With the assets command of the TiCons CLI / Module this can be done even simpeler by calling $ ticons assets
or an alloy.ymk
using:
task("pre:load", function(event, logger) {
require('ticons').assets();
});
'Label[platform=android]': { | |
color: '#000' // all platforms except Android default to black | |
} | |
'Window': { | |
backgroundColor: '#fff' // white background instead of default transparent | |
} | |
'Window[platform=android]': { | |
modal: false // make android windows all heavyweight |
I guess just like me you like to do alert('My message');
instead of:
Ti.UI.createAlertDialog({
message: 'My message'
}).show();
But I'd even more like to do alert('My message', 'My title', myCallback);
instead of:
I like easy drop-in CommonJS libraries that need minimal configuration to perform common tasks.
This CommonJS library checks with Apple every X days to see if there's a new version available. If so, it asks the user if he/she would like to update and then opens the app in the App Store.
At minimum, the library requires no configuration at all and just a single line of code.
Look at advanced.js
for all available options and methods.
Also check out my rating library:
var v = Ti.UI.createView(); | |
var s = new require('spinner').Spinner( | |
v, // View to spin | |
30 // Degrees to spin per millisecond | |
); // Auto-starts | |
// Stop | |
s.stop(); |
To make sure your lay-outs look pretty much the same on all devices, including the thousands of different Android resolutions and densities, it's always best to use the 'dp' unit. However, typing '10dp'
instead of 10
is quite a pain. A pain you can easily take away by changing the default unit in your tiapp.xml
.