HowTo: Custom back button in TableView
I am overriding the back button in a window opened from a TableView via:
window.setLeftNavButton(cancelButton);
I am doing this so I can do special processing before allowing the user to exit back to the TableView.
I am "exiting back to the TableView" via:
window.close();
This all works great. The problem is that using this code I no longer see the default TableView animation whereby the TableView window is slid in from the left and the current window slid out to the right.
What I see is that the current window is hidden entirely and then the TableView animation happens. So, basically I see a black screen (my app's backgroundColor) and then the TableView sliding in from the left as the black screen slides out to the right.
I'm assuming this is because I'm calling window.close().
Is there another/better way to hook custom behavior onto the "back" button without the blank screen behavior?
2 Answers
-
I was reading a Q&A post recently where you can apply a transition to the close method - much like you do with open. You can try something along those lines.
-
@David
Yeah, I tried an animation on close. Unfortunately, Titanium waits for the window to be completely out of view before sliding in the previous window of the TableView. So basically, this doesn't seem possible in Titanium.
I suppose I could try using a NavigationGroup, but to be honest I doubt that would work either as both of these classes are built from the same underlying iPhone class: UINavigationController (well, TableView is a UITableViewController wrapped in an UINavigationController).
Oh well….