Strange animation on iOS 7 when using hidesBottomBarWhenPushed in app built targeting <= iOS 6

好久不见. 提交于 2019-12-20 16:25:51

问题


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.



来源:https://stackoverflow.com/questions/18883121/strange-animation-on-ios-7-when-using-hidesbottombarwhenpushed-in-app-built-targ

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