How do I create a window with a title, navbar and button bar?
I wish to create a window with a title bar and button bar but do not wish to use a tab group.
I tried the following without success:
var win = Titanium.UI.createWindow({
title: "Home",
backgroundColor: '#bbb',
navBarHidden:false
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.setToolbar([b]);
win.add(Titanium.UI.createLabel({text: "Label"}));
win.open();
Neither the toolbar or the title show, however if I place this content inside a TabGroup
it functions as expected.
If I can't get this behaviour by default, could someone please demonstrate how to create a label (or button) using the system rendered style for the title and if its possible to do something similar to get the button bar at the bottom?
The following does work:
var win = Titanium.UI.createWindow({
title: "Home",
backgroundColor: '#bbb',
navBarHidden:false
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.setToolbar([b]);
win.add(Titanium.UI.createLabel({text: "Label"}));
var tabGroup开发者_如何学JAVA = Titanium.UI.createTabGroup();
tabGroup.addTab(Titanium.UI.createTab({
title:'Home',
window:win
}));
tabGroup.open();
It seems I can get what I'm after by wrapping my window in another window using a navigation group:
var win = Titanium.UI.createWindow({
title: "Home",
backgroundColor: '#bbb'
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.setToolbar([b]);
var nav = Titanium.UI.iPhone.createNavigationGroup({
window:win
});
var root = Titanium.UI.createWindow();
root.add(nav);
root.open();
I don't really need the navigation group, but it does what I'm after.
精彩评论