Ramotion / animated-tab-bar

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
https://www.ramotion.com/animated-tab-bar-ios-app-development-ui-library/
MIT License
11.13k stars 1.33k forks source link

hidesBottomBarWhenPushed breaks animationTabBarHidden() #109

Closed kiwo12345 closed 8 years ago

kiwo12345 commented 8 years ago

hidesBottomBarWhenPushed breaks animationTabBarHidden()

I am using animationTabBarHidden() in order to hide the tab bar items. But this will leave a blank space on the bottom of my screen so I also need to set hidesBottomBarWhenPushed = true

When I now push from Vc1 to Vc2 the tab bar + the items is hidden which is right. But when I go back again from Vc2 to Vc1 the tab bar + items will show up again but then the tab bar items disappears again

kiwo12345 commented 8 years ago

Ok I found a solution/hack for this.

In storyboard set hidesBottomBarWhenPushed to true on both VC1 and VC2.

Then add this to VC1 in viewdidLoad:

let animatedTabBar = self.tabBarController as! RAMAnimatedTabBarController
        animatedTabBar.animationTabBarHidden(false)

And in VC2 add the reverse in viewDidLoad:

let animatedTabBar = self.tabBarController as! RAMAnimatedTabBarController
        animatedTabBar.animationTabBarHidden(true)

+

override func viewWillDisappear(animated: Bool) {
        // Show TabBar
        super.viewWillDisappear(animated)
        let animatedTabBar = self.tabBarController as! RAMAnimatedTabBarController
        animatedTabBar.animationTabBarHidden(false)
    }

This will hide/show both the tab bar and its items when going back and forth the two VC's

allenwong commented 8 years ago

It works!!!!!!!!! Thanks A Lot!!!!!!

allenwong commented 8 years ago

It works very well on hide and show the tab bar / items back. In my case, I have two tab bar items, when I switch to another tab, the tab bar was miss.