navigation in windows with no tabs
First post, please forgive the newbie questions forthcoming…
I'm working on an iPhone app and I've created the root window and button like this:
var rootWin = Titanium.UI.createWindow({
title:'root window',
backgroundColor:'#fff'
});
var mapBtn = Titanium.UI.createButton({
title:"Maps"
});
mapBtn.addEventListener("click", function(e){
var mapWin = Titanium.UI.createWindow({
url:"maps.js",
title:"Maps"
});
var closeBtn = Titanium.UI.createButton({
title:'Close',
style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN
});
mapWin.open();
});
rootWin.open();
On this page I see no tabs and no navigation or title at the top of the screen. I've added buttons that open other windows and each of these windows don't have a back button or a title at the top of the screen.
I have to exit the app to get back to the rootWin
advTHANKSance!
Eric
3 Answers
-
Accepted Answer
You have to append close button on the opened window. mapWin.setLeftNavButton(closeBtn);
Also, you have to use tab object to launch tab, and i believe, i could be wrong, the title only shown on tabbed window.
var tabGroup = Titanium.UI.createTabGroup(); var Tab1 = Titanium.UI.createTab({window:rootWin,title:"Root Windows"}); tabGroup.addTab(Tab1); tabGroup.open();
-
Thanks for writing Daniel,
I guess this is getting to the "root" of my question. Does the parent have to be a tabGroup? I would like to avoid tabs if possible. I can create a parent that is a window object, but it's children do not get the the navbar, I /believe/ that leftNavButton is only available when the window is the child of a tab.
I tried with the first chunk of code and it fails for me, in fact the window doesn't even load.
Whoops, looks like you meant:
mapWin.LeftNavButton(closeBtn);
-
There's many samples in KitchenSink you can refer to.
You can hide tab with window.hideTabBar();