Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Mobile: Something is not right with the animation of currentWindow.close() method

Hi Guys,

This has been troubling me for a while so please help if you can!

With the following code:

var winNew = Ti.UI.createWindow({title:'Test Window', ...(other properties) });

I am creating a new window and opening it by the currentTab.

However, if I run the following closing method, the animation is not as expected as comparing to native iphone method.

var win = Ti.UI.currentWindow;   // This = winNew


What was supposed happen is that by closing the current window, the window will perform a animation that shifts itself to the right while the previous window enters the scenes from the left.

However this is not what's happening with when coding in Titanium. The win.close() simply fades out (flash to black) the current window while the previous window enters from the left.

Anyone have any idea on this?? Please help! thanks in advance!!

— asked May 24th 2010 by William Xue
  • close()
  • currenttab
  • currentwindow
  • iphone
  • mobile
  • titanium

6 Answers

  • You need to add the transition you want the window to close with:

    — answered May 24th 2010 by Dan Tamas
  • Struggeling with the exact same problem as the topics starter for 2 days now. The window itself does seem to do the right animation (flip to right or left), but the Navigation Bar at the top doesn't seem to do the desired effect. It just stays still and changes, not animating…

    Tried Tamas' suggestion, but then i get an error:

    Result of expression 'Titanium.UI.iPhone.AnimationStyle' [undefined] is not an object.";



    … also does not seem to work for the Navigation Bar

    I'm using a custom barImage and a custom backbutton at the navigation bar. Maybe that's the problem?

    edit: you can see the problem in KitchenSink: Base UI > Window NavBar > Back button BG. Then use the back button and you'll see the "NavBar" is not animating properly. Seems like a bug then?

    — answered January 19th 2011 by Jordy van den Aardweg
    • Yes, does seem like a bug. Hope they get this fixed soon.

      — commented January 26th 2011 by Marshall Jones
    • Get rid of the custom back button. If you open in the current tab, it generates one to the previous window automatically, and does the reverse animation used to open it.

      — commented February 3rd 2011 by Josh Lewis
  • You get something better, but still not perfect, by using


    instead of:

    — answered February 3rd 2011 by Mario Capocaccia
  • Thanks for your reply Tamas.

    What I wannted was sort of effect that is similiar to hitting the Back button on a window's left navBar.

    — answered May 24th 2010 by William Xue
  • Had same issue, Ti.UI.currentTab.close(win, {animated: true}); worked for me

    — answered January 14th 2013 by Christopher Stea
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.