开发者

Force Titanium (iPhone) navigation group window to refresh

开发者 https://www.devze.com 2023-03-23 08:34 出处:网络
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.

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 actua开发者_运维知识库lly a lot bigger, and it usually is not one window after another but could drill down to 4, 5 different windows)


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消