I've started a new titanium mobile project (1st time!). I have a file main.js with a tab group and 2 tabs linking to two windows. My first tabs seems to load up fine but everything after that seems to crash. I can't click on a list item or fire a buttons click event. My second tab doesn't work. It's not all the time though. Half the time it's fine, the other half it crasehs. Here is my code:
app.js:
Titanium.UI.setBackgroundColor('#fff');
var main = Ti.UI.createWindow({
url:'main_windows/main.js',
height:Ti.Platform.displayCaps.platformHeight,
width:Ti.Platform.displayCaps.platformWidth,
fullscreen: true,
navBarHidden: false
});
main.open();
main.js:
var win = Ti.UI.currentWindow;
var appointments = Titanium.UI.createWindow({});
appointments.url = 'appointments.js';
var quotes = Titanium.UI.createWindow({});
quotes.url = 'quotes.js';
var tabAppointments = Titanium.UI.createTab({
icon:'../KS_nav_views.png',
title:'Appointments',
window:appointments
});
var tabQuotes = Titanium.UI.createTab({
icon:'../KS_nav_views.png',
title:'Quotes',
window:quotes
});
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// add tabs
//
tabGroup.addTab(tabAppointments);
tabGroup.addTab(tabQuotes);
// open tab group
tabGroup.open();
When I launch my app the appointments window is loaded. But when I click the quotes tab or one of the list items nothing happens.
Here is my appointments.js file:
var win = Ti.UI.currentWindow;
win.backgroundColor = '#fff';
win.title = 'Appointments';
var data = [
{title:'Billy Jones', hasChild:true},
{title:'Adrian Hart', hasChild:true},
{title:'Sid Vel', hasChild:true},
{title:'Andrew Coats', hasChild:true}
];
// create table view
var tableview = Titanium.UI.createTableView({
data:data
});
win.add(tableview);
My quotes.js file is identical to the above but with a different window title.
Like I said sometimes the every seems to work then I rebuild the code and it's not working again.
Any help most appreciated!
Billy