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) });
Ti.UI.currentTab.open(winNew);
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
win.close();
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!!
6 Answers
-
You need to add the transition you want the window to close with:
win.close({transition:Titanium.UI.iPhone.AnimationStyle.CURL_UP});
-
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.";
and…
close({animated:true})
… 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?
-
You get something better, but still not perfect, by using
win.tab.close(win)
instead of:
win.close()
-
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.
-
submitted a ticket for this: https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2958-when-leftnavbutton-used-as-a-back-button-navbar-transition-animation-fails
-
Had same issue,
Ti.UI.currentTab.close(win, {animated: true});
worked for me