Hi guys,
Hopefully a quick one here.
Using iOS and the latest Titanium SDK I have a 5 tab app.
I'm at the last couple of bits required before submission to Apple.
The client has requested that when you tap any of the tab bar icons at the bottom of the app, the view will always revert back to the start of the user journey.
So, say the App has a 'Home' tab bar item, and the user taps it a few times and cycles their way through lots of window views, they then have to press back in the top left many time in order to get back to the main screen.
What they want to happen, is for the user to simply tap the tabbar and for the original starting point view to be shown.
How can I do this?
Simon
3 Answers
By tab bar icons, do you mean the tabs in a tab group? If so, assuming each child window is being opened inside the current tab with something like tabGroup.activeTab.open(win), then this should happen automatically.
I'm pretty sure a double-tap on the tab will do this.
If not, you need to keep a track of an array/stack of the windows you have opened, so that when the tab is clicked (with a click eventListener) you can then loop through them and close them and get back 'home'.
I think I've finally found the part in customTabBar.js that is causing the issue. Can anyone shed any light on what to add inside this function to make the native function work as it should?
You can see the TODO item listed, which is where it needs to live.
Here is the full script on GitHub
var assignClick = function(tabItem) { tabItem.addEventListener('click', function(e) { // Just fetching the 'i' variable from the loop var pos = e.source.pos; if (tabCurrent == pos) { // TODO // Change back to root window, like the native tab action. return false; } // Switch to the tab associated with the image pressed settings.tabBar.tabs[pos].active = true; tabCurrent = pos; // Reset all the tab images resetTabs(); // Set the current tab as selected tabBarItems[pos].image = settings.imagePath + settings.items[pos].selected; }); };
Your Answer
Think you can help? Login to answer this question!