Skip to content

Instantly share code, notes, and snippets.

@pec1985
Created March 23, 2011 22:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pec1985/884184 to your computer and use it in GitHub Desktop.
Save pec1985/884184 to your computer and use it in GitHub Desktop.
Center the title of a row with the Super Cool Row function
// Created by @pecdev with the help of @pec1985
// Follow either on Twitter
//
// Center the title of a row with the Super Cool Row function
var tableData = [];
function mySuperCoolRow(e){
var row = Ti.UI.createTableViewRow({backgroundColor:e.bgColor,height:e.height});
var label = Ti.UI.createLabel({text:e.title,width:'auto',height:50,font:{fontSize:20,fontWeight:'bold'}});
row.add(label);
return row;
}
for (var i = 0;i<20;i++){
tableData[i] = mySuperCoolRow({title:'Hello '+i,height:75,bgColor:'#ccc'});
}
var table = Ti.UI.createTableView({data:tableData});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment