Skip to content

Instantly share code, notes, and snippets.

@nazrdogan
Forked from tzmartin/sticky-table-headerview.js
Created December 21, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazrdogan/0527bc41ea131a1bb37e to your computer and use it in GitHub Desktop.
Save nazrdogan/0527bc41ea131a1bb37e to your computer and use it in GitHub Desktop.
Titanium Sticky Header
// 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'}));
headerView.add(Ti.UI.createButton({title:'$1000',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
var sections = [];
sections[0] = Ti.UI.createTableViewSection();
var row1 = Ti.UI.createTableViewRow({height:320});
row1.add(Ti.UI.createImageView({width:320,height:Ti.UI.FILL,image:'http://upload.wikimedia.org/wikipedia/commons/2/2b/2nd_Toyota_Prius.jpg'}));
sections[0].add(row1);
sections[1] = Ti.UI.createTableViewSection({
headerView:headerView
});
sections[1].add(Ti.UI.createTableViewRow({
height:1000,
backgroundColor:'#efefef'
}));
var win = Titanium.UI.createWindow({backgroundColor:'#fff'});
var table = Ti.UI.createTableView({
data: sections
});
win.add(table);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment