点击我的按钮,我想导航到另一个屏幕。我如何在Titanium中实现这一目标?
var TrialButton = Titanium.UI.createButton({
color:'black',
backgroundColor:'#FFFFFF',
title:'Trial Mode',
top:55,
width:300,
height:50,
borderRadius:5,
font:{fontSize:18, fontFamily :'Helvetica', fontWeight:'bold'}
});
TrialButton.addEventListener('click', function() {
var newWindow = Titanium.UI.createWindow({
background : "#fff",
title : "Trial Demo",
url:"nextScreen.js"
});
newWindow.open();
});
答案 0 :(得分:3)
TrialButton.addEventListener('click', function()
{
var newWindow = Ti.UI.createWindow({
background : "#000",
title : "Image View",
url:"nextScreen.js"
});
newWindow.open();
)};
应该在此处查看示例https://github.com/appcelerator/KitchenSink
以下是我的博客http://blog.clearlyinnovative.com/tagged/Appcelerator
中的一些帖子答案 1 :(得分:2)
如果您正在使用Alloy,您还可以使用Alloy.createController方法导航到另一个屏幕。
功能样本(e){
var nextScreen = Alloy.createController('nameOfNextScreen').getView();
nextScreen.open();
}
如果您愿意,您也可以将数据作为参数传递到下一个屏幕,例如
var nextScreen = Alloy.createController('nameOfNextScreen',{sushi:“california roll”})。getView();
并使用以下
在下一个屏幕中检索参数var args = $ .args;
var value = args.sushi;
答案 2 :(得分:0)
TrialButton.addEventListener('click', function()
{
var newWindow = Ti.UI.createWindow({
background : "#000",
title : "Image View",
url:"nextScreen.js"
});
newWindow.open();
//close your current window of this page and also in your nextScreen.js page, the window must be set to current window
)};
答案 3 :(得分:0)
TrialButton.addEventListener('click', function()
{
var newWindow = Ti.UI.createWindow({
background : "#000",
title : "Image View",
url:"nextScreen.js"
});
newWindow.open();
//close your current window of this page and also in your nextScreen.js page, the window must be set to current window
});