Skip to content

Instantly share code, notes, and snippets.

@flopezluis
Created December 29, 2010 12:32
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 flopezluis/758489 to your computer and use it in GitHub Desktop.
Save flopezluis/758489 to your computer and use it in GitHub Desktop.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'List1',
backgroundColor:'#fff',
url:'list.js'
});
var tab1 = Titanium.UI.createTab({
title:'List1',
window:win1
});
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'List2',
backgroundColor:'#fff',
url:'list.js'
});
var tab2 = Titanium.UI.createTab({
title:'List2',
window:win2
});
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open({
transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
var win = Titanium.UI.currentWindow;
var defnWebView;
var table;
var defnRow;
var data = [];
data[0] = Titanium.UI.createTableViewSection();
defnRow = Titanium.UI.createTableViewRow({
height:'auto'
});
defnWebView = Titanium.UI.createWebView({
height:'auto',
html:"<html><body style='font-size:12px;'><div id='content'><p><span style=\"font-family: Arial, Helvetica, sans; font-size: 11px; line-height: 14px;\"><strong>Lorem Ipsum</strong>&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span></p>\r\n<p><span style=\"font-family: Arial, Helvetica, sans; font-size: 11px; line-height: 14px;\"><strong>Lorem Ipsum</strong>&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br /></span></p></div></body></html>",
borderRadius:8,
scalesPageToFit : false
});
defnRow.add(defnWebView);
data[0].add(defnRow);
table = Titanium.UI.createTableView({
data:data,
style:Titanium.UI.iPhone.TableViewStyle.GROUPED
});
win.add(table);
var win = Titanium.UI.currentWindow;
var data = [];
for (i = 0; i < 1; i++) {
data.push({title: 'Title'});
}
var tableview = Titanium.UI.createTableView({
top:0, left:0, bottom:0, right:0, data: data});
// create table view event listener
tableview.addEventListener('click', function(e)
{
var win = Titanium.UI.createWindow({
url:'detail.js',
title:e.rowData.title,
fullscreen:true,
tabBarHidden:true
});
Titanium.UI.currentTab.open(win,{animated:true});
});
win.add(tableview);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment