强制刷新 Titanium (iPhone) 导航组窗口

发布于 2024-11-26 16:16:20 字数 286 浏览 1 评论 0原文

我正在使用 Appceleartor Titanium 引擎为 iPhone 开发数据驱动的应用程序。

简而言之,我有一个带有名字变量(标签)的窗口和一个按钮。 单击该按钮,它会将您带到第二个窗口(通过导航组)。在第二个窗口中,您可以更改 first_name 变量。

所以问题是,当用户单击“后退”按钮返回到导航组中的第一个窗口时,如何反映first_name变量的变化?

(first_name变量只是一个抽象,实际的数据变化实际上要大得多,而且通常不是一个又一个窗口,而是可以深入到4、5个不同的窗口)

I am developing a data-driven application for iPhone using Appceleartor Titanium engine.

To cut it short, I have one window with first_name variable (label) on it and a button.
You click on the button, it bring you to the second window (through navigation group). ANd in this second window you can change the first_name variable.

So the question is, as the user click "Back" Button to go back to the first window in the navigation group, how do I reflect the first_name variable change?

(The first_name variable is just an abstract, the actual data change is actually a lot bigger, and it usually is not one window after another but could drill down to 4, 5 different windows)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪痕残 2024-12-03 16:16:20

事件监听器。在第一个窗口中添加类似的内容

window0.addEventListener('refreshLabel',function(e){
  label.text = e.value;
});

,然后在第二个窗口中触发事件

button.addEventListener('click',function(e){
  window0.fireEvent('refreshLabel',{value:"myNewContent"});
};

eventListener. add in the first window something like

window0.addEventListener('refreshLabel',function(e){
  label.text = e.value;
});

and in the second window fire the event

button.addEventListener('click',function(e){
  window0.fireEvent('refreshLabel',{value:"myNewContent"});
};
如果没有你 2024-12-03 16:16:20

您可以在标签上放置一个事件侦听器,并在内容发生更改时触发更新。

您可以为标签创建一个更新方法,并将其放置在 gloval 命名空间中,使其可以从其他窗口调用。

You can put an event listener on the label and fire an update when the contents should he changed.

You can create an update method for the label and place it in the gloval namespace making it available to he called from the othe window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文