iOS7 strange animation when using hidesBottomBarWhenPushed

喜你入骨 提交于 2019-11-28 07:49:38

Solved my problem:

self.tabBarController.tabBar.hidden=YES;

In the second view controller is the way to go.

Leo Natan is correct. The reason for this blur effect is because the entire Tab Bar Controller is being animated underneath the navigation controller, and behind that view is a black UIWindow by default. I changed the UIWindow background color to white and that fixed the issue.

hidesBottomBarWhenPushed seems to work great with UITabBars (iOS 7/8).

Nico

In My Case, I had TabBarViewController with UINavigationController in each tabs & faced similar issue. I used,

nextScreen.hidesBottomBarWhenPushed = true
pushViewToCentralNavigationController(nextScreen)

It works fine when nextScreen is UITableViewController subclass & applied auto layout. But, It does not work fine when nextScreen is UIViewController. I found it depends on nextScreen auto layout constraints.

So I just updated my currentScreen with this code -

override func viewWillDisappear(animated: Bool) {

        super.viewWillDisappear(animated)

        self.tabBarController?.tabBar.hidden = true

    }

For more details - https://stackoverflow.com/a/39145355/2564720

Turn off the Translucent property of Navigation Bar in Storyboard.

An elegant way of doing this, while keeping transparency, is to add this to the root UIViewController:

- (void)viewWillAppear:(BOOL)animated {
    [UIView animateWithDuration:0.35f animations:^{
        self.tabBarController.tabBar.alpha = 1.0f;
    }];
}

- (void)viewWillDisappear:(BOOL)animated {
    [UIView animateWithDuration:0.35f animations:^{
        self.tabBarController.tabBar.alpha = 0.0f;
    }];
}

This way you'll get a nice fade-in/fade-out animation of the tab bar.

What if in the second view controller in viewWillAppear you put

[self.navigationController setToolbarHidden:YES animated:NO];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!