Titanium: navigation from one screen to other

帅比萌擦擦* 提交于 2019-12-03 22:58:20
 TrialButton.addEventListener('click', function()
 {
    var newWindow = Ti.UI.createWindow({
        background : "#000",
        title : "Image View",
        url:"nextScreen.js"
    });
    newWindow.open();             
 )};

should checkout examples here https://github.com/appcelerator/KitchenSink

here are some posts from my blog http://blog.clearlyinnovative.com/tagged/Appcelerator

If you're using Alloy, You can also navigate to another screen using the Alloy.createController method.

function sample(e) {

var nextScreen = Alloy.createController('nameOfNextScreen').getView();

nextScreen.open();

}

If you wish, you can also pass data to the next screen by passing it in as an argument eg,

var nextScreen = Alloy.createController('nameOfNextScreen', {sushi: "california roll" }).getView();

and retrieving the argument in the next screen with the following

var args = $.args;

var value = args.sushi;

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         
 )};

Because its written wrong. Theres an error in code at the last line. The ")" has to follow after "}". Not opposite ast written here. So the closing tag is right like this: "});". Use following code instead:

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         
 });
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!