【问题标题】:appcelerator: Pushing new window in to modal windowappcelerator:将新窗口推入模态窗口
【发布时间】:2015-12-17 18:21:14
【问题描述】:

大家好,我对 Appcelerator 中的模态视图有疑问。目前,我在应用程序中显示了一个带有导航窗口的模态视图(见下文)。

//this is my modal 
<Alloy>
    <NavigationWindow id="win1" platform="ios">
        <Window id="win2" title="Red Window" backgroundColor="red">

        </Window>
    </NavigationWindow>
</Alloy>

//this is the window i want to push in this modal view. 
<Alloy>
    <Window id="win3" title="Blue Window" backgroundColor="blue">
    </Window>
</Alloy>

在我的 win2.js(这是我的父窗口,也是我的模态窗口)中,我有以下内容

var window = $.win2;
var navigationwindow = $.win1;

var button = Titanium.UI.createButton({
    title: 'Open Blue Window'
});

button.addEventListener('click', function(){
    navigationwindow.openWindow(win3, {animated:true});
});

但这并没有做任何事情。甚至可以在模态窗口中推送窗口吗?

如果这里有人可以帮助我,我将非常高兴。

【问题讨论】:

    标签: ios titanium-alloy appcelerator-mobile


    【解决方案1】:

    openWindow() 推送新窗口的正确方法,但在您的 win2.js 控制器中,$ 变量将仅包含对您在 win2.xml 中创建的元素的引用,而不是查看您创建导航窗口的位置。在该视图的控制器中,添加类似Alloy.Globals.nav = $.win1 的引用(确保在关闭导航窗口后清理),然后您可以在win2.js 中使用它。

    【讨论】:

    • 何福克谢谢你我已经解决了问题:) 谢谢你的回答。我期待在阿姆斯特丹见面,如果你组织得对的话。
    • 我确定!在那里见
    猜你喜欢
    • 2011-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多