Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created March 15, 2011 17:21

Revisions

  1. jonalter created this gist Mar 15, 2011.
    7 changes: 7 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Titanium.UI.setBackgroundColor('#000');

    var BHunter = {};

    Ti.include('ui.js');
    BHunter.tabGroup = BHunter.ui.createAppTabGroup();
    BHunter.tabGroup.open();
    48 changes: 48 additions & 0 deletions ui.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    (function() {
    BHunter.ui = {};

    BHunter.ui.createTableWindow = function(_e) {
    var win = Ti.UI.createWindow({
    title: _e.title
    });
    var data = [
    {title: 'test 1'},
    {title: 'test 2'},
    {title: 'test 3'},
    {title: 'test 4'},
    {title: 'test 5'}
    ];

    var tableView = Ti.UI.createTableView({
    data: data
    });

    win.add(tableView);

    return win;
    };

    BHunter.ui.createAppTabGroup = function() {

    var tabGroup = Titanium.UI.createTabGroup();

    var tab1 = Titanium.UI.createTab({
    title: 'Fugitives',
    window: BHunter.ui.createTableWindow({title: 'Fugitives'})
    });

    var tab2 = Titanium.UI.createTab({
    title: 'Captured',
    window: Titanium.UI.createWindow({
    title: 'Captured',
    backgroundColor:'#fff'
    })
    });

    tabGroup.addTab(tab1);
    tabGroup.addTab(tab2);

    return tabGroup;
    };

    })();