Skip to content

Instantly share code, notes, and snippets.

View alanleard's full-sized avatar

Alan Leard alanleard

View GitHub Profile
@alanleard
alanleard / app.js
Created January 23, 2013 20:56
simple calendar link for iOS
var text = Ti.UI.createTextArea({
value:'Event: Jan 25, 2012 at 5:00pm',
autoLink: Ti.UI.iOS.AUTODETECT_CALENDAR,
top:100,
enabled:false,
font:{fontSize:16}
});
var win = Ti.UI.createWindow({backgroundColor:'#fff'});
@alanleard
alanleard / app.js
Created January 16, 2013 19:03
Android Vertical Slider
var win = Ti.UI.createWindow();
var container = Ti.UI.createView({
height:260,
width:30
})
var slider = Ti.UI.createView({
height:200,
width:20,
@alanleard
alanleard / app.js
Created December 12, 2012 19:09
mimic iOS switch
var win = Ti.UI.createWindow();
var switchContainer = Ti.UI.createView({
width:100,
height:40,
borderRadius:10,
backgroundColor:'gray'
});
var switchLabelYes = Ti.UI.createLabel({
@alanleard
alanleard / app.js
Created December 6, 2012 19:50
Infinite Remote ImageView Scrollable
/*
Recognized parameters:
imageListURL - string (URL to JSON array of image names, if not available, imageList will be used)
imageList - array (array of image names to be added to imageURL, not used if imageListURL present)
imageURL - string (base url of images)
defaultImage - string (preventDefaultImage set if not used)
scrollable - object (pass in your own scrollableView)
scrollProps - object (pass in your own scrollable properties)
Sample Usage:
@alanleard
alanleard / app.js
Created December 5, 2012 15:22
Android Local Notification
var intent = Ti.Android.createServiceIntent({url: 'notification.js'});
Ti.Android.stopService(intent);
////*notification.js*////////
Titanium.Android.NotificationManager.notify(
0, // <-- this is an ID that we can use to clear the notification later
Ti.Android.createNotification({
//contentView: customView,
@alanleard
alanleard / app.js
Created August 2, 2012 19:05
Scroll Image
var lImageView = Ti.UI.createScrollView({
height:labelSize.height,
width:labelSize.width,
contentHeight:'auto',
contentWidth:'auto',
minZoomScale:0.05,
maxZoomScale:5.0,
zoomScale:1.0
});
@alanleard
alanleard / app.js
Created July 18, 2012 21:21
Underline function
var win = Ti.UI.createWindow();
win.open();
function label(args){
var view = Ti.UI.createView({
width:'size',
height:'size',
layout:'vertical'
});
@alanleard
alanleard / app.js
Created June 1, 2012 23:34
2 height draggable menu
var win = Ti.UI.createWindow({
backgroundColor: '#333'
});
var menu = Ti.UI.createView({
backgroundColor:'blue',
top:Ti.Platform.displayCaps.platformHeight-50,
bottom:0
});
@alanleard
alanleard / app.js
Created May 30, 2012 16:27
Menu Animation
var win = Ti.UI.createWindow();
var mainView = Ti.UI.createView();
var parent1 = Ti.UI.createView({top:0, bottom:0, backgroundColor:'blue'});
var parent1Child1 = Ti.UI.createView({top:50, bottom:0, backgroundColor:'green'});
parent1.add(parent1Child1);
@alanleard
alanleard / app.js
Created March 7, 2012 01:53
Circle Pictures
var win = Ti.UI.createWindow({backgroundColor:'#000'});
var dialog = Titanium.UI.createOptionDialog({
options: ['Camera','Gallery', 'Cancel'],
cancel:2
});
dialog.show();