Skip to content

Instantly share code, notes, and snippets.

@iskugor
Created December 14, 2011 13:52
Show Gist options
  • Save iskugor/1476642 to your computer and use it in GitHub Desktop.
Save iskugor/1476642 to your computer and use it in GitHub Desktop.
Titanium tabgroup crash (FIXED in 2.0)
var button = Ti.UI.createButton({
title: 'Click me!'
});
var win = Ti.UI.createWindow({
navBarHidden: true,
backgroundColor: '#000'
});
win.add(button);
button.addEventListener('click', function() {
var actInd = Ti.UI.createActivityIndicator({
height: 20,
width: 20
});
actInd.show();
var tabs = require('test').create();
tabs.addEventListener('open', function() {
Ti.API.info('Tabs "open" event');
actInd.hide();
});
tabs.addEventListener('close', function() {
Ti.API.info('Tabs "close" event');
});
tabs.addEventListener('android:back', function() {
Ti.API.info('Tabs "android:back" event');
});
tabs.open();
});
win.open();
exports.create = function() {
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
backgroundColor: '#fc0'
});
var win2 = Ti.UI.createWindow({
backgroundColor: '#3f9'
});
var win3 = Ti.UI.createWindow({
backgroundColor: '#cf3'
});
var tab1 = Ti.UI.createTab({
title: 'Tab 1',
window: win1
});
var tab2 = Ti.UI.createTab({
title: 'Tab 2',
window: win2
});
var tab3 = Ti.UI.createTab({
title: 'Tab 3',
window: win3
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addTab(tab3);
return tabGroup;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment