Titanium Community Questions & Answer Archive

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

Dynamically hiding/showing the tabBar

I have a tabGroup with five tabs, the first of which is a "Home" tab. When a user is "logged in", I want the tab bar to be visible, and when the user logs out, the tab bar should not be accessible.

I have tried using the modal, fullscreen, and tabBarHidden properties of the window, and none of these seem to do the trick - I assume the problem is that they're intended to be used during the window creation, not for "on the fly" style changes.

I tried adding and removing tabs from the tab group whenever the user logged in or out, but I ran into some issues with mutating a collection while it was being enumerated, which I was unable to resolve. Is there some other more reasonable approach? Even just disabling the tab bar, or moving it off the viewable area would be fine, if I could figure out how.

— asked April 27th 2010 by Mike Dosey
  • 1.2
  • fullscreen
  • iphone
  • mobile
  • modal
  • tab
  • tabbar
  • tabbarhidden
  • tabgroup

5 Answers

  • From what I gather is there is no showTabBar method as of in 1.7.3. However, the confusing thing is that you do not need a showTabBar method. Instead of calling hideTabBar on your activeTab in a tabGroup call it on the child tab window.

     currentTab.open(win, {animated : true});

    You would think you would call hideTabBar on the tab itself. Instead, you are calling it on the child window. When the child window is closed the tabBar magically reappears. So thing of the tabBar as an entity independent from the actual tab window.

    This is convenient, but not the first conclusion I would immediately come to.

    — answered October 29th 2011 by Stephen Rhyne
    1 Comment
    • Oops excuse the grammar "..is there is.."

      — commented October 29th 2011 by Stephen Rhyne
  • There's a hideTabBar() method in the window class to do what you need: youWinObj.hideTabBar()

    — answered April 28th 2010 by Kyle Quest
  • That doesn't take care of re-displaying the tab bar, though. I'm not aware of any showTabBar() type method.

    — answered April 28th 2010 by Mike Dosey
  • Mike…

    Did you ever come across some solution for this? I'm trying to do exactly what you are doing….

    — answered May 10th 2010 by Stephen Gilboy
  • I'm afraid I never did find an answer, and had to settle for a work-around. I made the "logged out" display its own window/view with tabBarHidden = true. Then I just call the hide() or show() methods on this window as needed. There is a separate window/view for the "logged in" status, which is part of the tab group.

    — answered May 10th 2010 by Mike Dosey
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.