Skip to content

Instantly share code, notes, and snippets.

@meeech
meeech / gist:3125227
Created July 16, 2012 21:35
ellipsize
var win1 = Titanium.UI.createWindow({
backgroundColor:'#ccc',
exitOnClose:true,
title:'win1: Main Window'
});
var label1 = Ti.UI.createLabel({
top: 10,
backgroundColor:'black',
color:'white',
ellipsize:true,
//Fetch file, save to cache, and attach to the passed in item.
//imageUrl: http link to image
//file: Ti File
//item: a Ti.UI.ImageView
var fetchAndCache = function(imageUrl, file, item) {
var adxhr = Titanium.Network.createHTTPClient();
adxhr.onload = function() {
file.write(this.responseData);
item.image = file.nativePath;
@meeech
meeech / gist:2705664
Created May 15, 2012 22:37
Longpress example for Titanium toolbar
var win = Ti.UI.createWindow({
backgroundColor: "#ccc",
fullscreen: true,
modal: true
});
//Create the button. We use backgroundImage so that we get
//the standard effect where the button get grey when tapped
var button = Titanium.UI.createButton({
width: 40,
var props = data.properties || {};
var obj = Ti.UI.createWindow(props);
-(void)setScrollsToTop_:(id)value
{
[[self tableView] setScrollsToTop:[TiUtils boolValue:value]];
}
@meeech
meeech / gist:2031838
Created March 13, 2012 21:37
YUI Profiler code tweaked to run in titanium
/*
Profiler - Code base from YUI 3.4.1 (build 4118)
Brought required pieces into one file, to run in context of Titanium
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
(function(){
//Begin Closure
@meeech
meeech / gist:1895665
Created February 23, 2012 23:22
table flicker
// create table view data object
var win = Ti.UI.createWindow({
backgroundColor: "#ccc"
});
var data = [];
function addRow(text, detailtext){
var textContainer = Ti.UI.createView({
@meeech
meeech / gist:1760995
Created February 7, 2012 17:56
[ERROR] Adding an event listener to a proxy that isn't already in the context
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#ccc');
var win = Ti.UI.createWindow({
modal: false
});
var cView = Ti.UI.createScrollView({
layout:'horizontal',
height: 35,
@meeech
meeech / app.js
Created February 7, 2012 17:17 — forked from pec1985/app.js
SmartLabel
var UI = {};
var W = {};
var V = {};
var AUTODETECT_NONE = Ti.UI.iOS.AUTODETECT_NONE;
var AUTODETECT_ALL = Ti.UI.iOS.AUTODETECT_ALL;
var AUTODETECT_PHONE = Ti.UI.iOS.AUTODETECT_PHONE;
var AUTODETECT_LINK = Ti.UI.iOS.AUTODETECT_LINK;
var AUTODETECT_ADDRESS = Ti.UI.iOS.AUTODETECT_ADDRESS;
var AUTODETECT_CALENDAR = Ti.UI.iOS.AUTODETECT_CALENDAR;
function writeBase64Asset($path, $data) {
return file_put_contents($path, base64_decode($data));
}