Strange animation on iOS 7 when using hidesBottomB

2019-03-17 14:11发布

问题:

This problem comes when I build an app targeting iOS 5 or 6, but run it on iOS 7. If I have a controller in a navigationController that is a part of a tabBarController, and I do the following:

controller.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:testController animated:YES];

A strange vertical positioning animation occurs. I would instead like the new controller (with the bottom bar hidden) to push or pop on the navigation controller pushing the tab bar out or bringing it back and with no vertical positioning changes.

Video of Issue: http://cl.ly/1w0g3j293m03

Open Radar Report: http://www.openradar.me/14670329

回答1:

You can always remove animation from the UIView with

[self.view.layer removeAllAnimations];

Cheers



回答2:

Try This:

[self.navigationController.navigationBar setHidden:NO];


回答3:

If you want to keep transparency, 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.



回答4:

Try this

if( [self respondsToSelector:@selector(setEdgesForExtendedLayout:)] )
{
    self.edgesForExtendedLayout=UIRectEdgeNone;
}


回答5:

this says you should put:

self.navigationController.navigationBar.translucent = NO;

follow this link



回答6:

Just set the translucent property to NO for both navigation bar and tabBarController. This will solve your problem.