【问题标题】:How can I create a home button?如何创建主页按钮?
【发布时间】:2013-09-25 02:47:00
【问题描述】:

我是编程界的新手。我正在使用 Titanium,我想要一个按钮,当我单击它时,它会返回主窗口。显然,该按钮将在另一个窗口中。

我尝试了win2.open()win2.show(),但它不起作用。有什么想法吗?

【问题讨论】:

  • 什么是win2?你能告诉我们更多代码吗?

标签: button titanium titanium-mobile


【解决方案1】:

使用钛导航控制器

https://github.com/vuinguyen/Ti-Navigation-Controller

它会给你上一个和主窗口的按钮

【讨论】:

    【解决方案2】:

    贾尔,

    如果您在第二个窗口中,只需在第二个窗口中的按钮单击事件时关闭该窗口。 在第二个窗口中尝试以下操作

    //I'm assuming that you have came from window1 to window2
    //and you have a button btnHome at window 2 used to navigate back to home page
    
    var thisWindow = Ti.UI.currentWindow;
    btnHome.addEventListener('click', function(e){
        thisWindow.close(); //Will close the current window and display the previous one
    });
    

    有一个类似的问题用于在窗口之间导航。通过Titanium Mobile: cant navigate between pages

    您也可以使用以下链接作为参考

    1. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-url
    2. http://docs.appcelerator.com/titanium/latest/#!/api/Global-method-require

    【讨论】:

    • 但是感谢您的回答。也许这是一个上下文问题你认为?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多