Skip to content

Instantly share code, notes, and snippets.

View jpurcell's full-sized avatar

Joe iEntry jpurcell

View GitHub Profile
@jpurcell
jpurcell / app.js
Created April 1, 2011 18:55
Debugging for TableView scroll event with Titanium Developer.
var win = Ti.UI.currentWindow;
var data = [
{title:"Row 1",color:'#000',height:50},
{title:"Row 2",color:'#000',height:50},
{title:"Row 3",color:'#000',height:50},
{title:"Row 4",color:'#000',height:50},
{title:"Row 5",color:'#000',height:50},
{title:"Row 6",color:'#000',height:50},
{title:"Row 7",color:'#000',height:50},
@jpurcell
jpurcell / tableview-scroll-change.js
Created April 1, 2011 19:25
Fire on scroll direction change.
var scrollingUp = false;
var prevIndex = 1;
Ti.API.debug('init: scrolling down');
tableView.scrollToIndex(1);
tableView.addEventListener('scroll',function(e){
Ti.API.debug('prev '+prevIndex+', curr '+e.firstVisibleItem+', scrollingUp '+scrollingUp);
if (prevIndex > e.firstVisibleItem) {
if (!scrollingUp) {
Ti.API.debug('scrolling up');
@jpurcell
jpurcell / pull-to-refresh(android).js
Created April 5, 2011 15:58
Tweetie-like pull to refresh and pull to load more. Note that it requries set heights for everything.
// This is the Android version of the Tweetie-like pull to refresh table:
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var scrollView = Ti.UI.createScrollView({