我想创建一个带有标题栏和按钮栏的窗口,但不希望使用选项卡组。
我尝试了以下但没有成功:
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();
工具栏或标题均未显示,但是如果我将此内容放在 TabGroup
中,它会按预期运行。
如果默认情况下我无法获得此行为,有人可以演示如何使用系统呈现的标题样式创建标签(或按钮),以及是否可以做类似的事情来获得按钮栏底部?
以下确实有效:
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 = Titanium.UI.createTabGroup();
tabGroup.addTab(Titanium.UI.createTab({
title:'Home',
window:win
}));
tabGroup.open();
最佳答案
似乎我可以通过使用导航组将我的窗口包装在另一个窗口中来获得我想要的东西:
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();
我真的不需要导航组,但它可以满足我的需求。
关于iphone - 如何创建带有标题、导航栏和按钮栏的窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6089308/