Search code examples
titanium-mobileappceleratorswipeview

how to change view with swipe titanium appcelerator


hello i have a problem: I have two views in a window and I wish with a swipe event is passed from one view to another as if it were a tabgroup.

Can anyone tell me how is it possible ? thanks so much


Solution

  • You need to use ScrollableView for this.

    your code will look like this:

    var win = Ti.UI.createWindow();
    
    var view1 = Ti.UI.createView({ backgroundColor:'#123' }); 
    var view2 = Ti.UI.createView({ backgroundColor:'#246' });
    var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
    
    var scrollableView = Ti.UI.createScrollableView({
       views:[view1,view2,view3],
       showPagingControl:true
    });
    
    win.add(scrollableView);
    win.open();