开发者

Appcelerator. Change content of window

开发者 https://www.devze.com 2023-03-25 00:47 出处:网络
I am developing an iOS app in Appcelerator. I got four tabs. How can I change the content of the window when the user clicks a special button or navbar title?

I am developing an iOS app in Appcelerator. I got four tabs. How can I change the content of the window when the user clicks a special button or navbar title?

For example if the tab_1 is set to open window_1.js in app.js how can I open w开发者_如何转开发indow_2.js in tab_1 upon button click? I would prefer not to use views since I would like the content of the window to be in seperate files.

Thankful for all input!


I ran into a similar road block the other day with a Titanium app I'm building. The Titanium.UI.TabGroup has a property called activeTab that is very helpful.

var my_other_view = Ti.UI.createView({params});
var my_tab_group = Ti.UI.createTabGroup({params});
my_tab_group.activeTab.open(my_other_view);

Of course, the code is significantly short-handed :) but it hopefully will steer you in the right direction so that you can implement the desired behavior in your app!

One of the cool thing (IMHO) about activeTab.open() is that, on iOS, a 'back' button will automatically be placed on the title bar so that the user can go back to the previous view/content.

0

精彩评论

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