Hero: UITabBar doesn't fade when transitioning to view with 'Hide Bottom Bar on Push' enabled

Created on 27 Mar 2018  路  5Comments  路  Source: HeroTransitions/Hero

Gif showing issue: https://cl.ly/1c1Q1Q2L2l3i

I have an issue where the tab bar isn't fading away when transitioning to a view where the 'Hide Bottom Bar on Push' option is enabled. It's just disappearing at the end of the transition.

I've searched around but can't find anything related. Any help?

Most helpful comment

Having the same issue as well.

All 5 comments

I'm having this issue to - did you manage to find a solution @djdmorrison ?

@edd677 - Nope, unfortunately not yet

Having the same issue.

Having the same issue as well.

Hey all 馃憢

I too am seeing the same problem... have got a workaround in place for my use case which works perfectly though 馃憣

In short it just came down to managing the tab bar's animation myself. Here's a simple function for sliding the tab bar up/down to show/hide it.

extension UITabBarController {

    func setTabBarVisible(_ visible: Bool, animated: Bool = true, completion: (() -> Void)? = nil) {

        // No State Change
        if isTabBarVisible == visible {
            completion?()
            return
        }

        let frame = tabBar.frame
        let height = frame.height
        let offset = visible ? -height : height
        let duration = animated ? 0.3 : 0

        UIView.animate(withDuration: duration, animations: {
            self.tabBar.frame = frame.offsetBy(dx: 0, dy: offset)
        }, completion: { success in
            completion?()
        })
    }

    var isTabBarVisible: Bool {
        return tabBar.frame.origin.y < view.frame.maxY
    }

}

Within my prepare(for:sender:) function I then hide the tab bar using my function. Within viewWillAppear I then show it again.

As I say, not beautiful but it does work alongside Hero and I'm happy with the results.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lkzhao picture lkzhao  路  5Comments

joeljfischer picture joeljfischer  路  3Comments

brendan-guegan-orange picture brendan-guegan-orange  路  4Comments

josmanperez picture josmanperez  路  3Comments

imfractured picture imfractured  路  5Comments