简体   繁体   中英

How to open another view on button click without creating a Window in Titanium?

I have to views: view1.xml, view2.xml. Both the files are already existing. I have a button in view1.xml and when user clicks on that button, I want to load view2.xml file in the same window. I do not want to create another window to load that view. I think I need to do add event listener to that button and load the view but I do not know how to do that.

I did something like this

$.next.addEventListener('click', function() {
var myView = Alloy.createController('nextView').getView();
$.main_window.add(myView);
});

Do something like this

var view=Alloy.createController('mycoolwindow').getView();
win.add(view);

You have to add the view in window instead of opening it like window

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM