iOS 11系统下遇到界面跳转,但导航栏不跟着跳转

接手公司的项目,前段时间用iOS 11系统的手机运行程序,发现了一个bug,在程序首页界面跳转,但导航栏不跟着跳转.经排查原因,问题出在了这块代码上,记录一下.

GHTabBarController * tabBarController = [[GHTabBarController alloc] init];
HDMainNavigationController * tabBarNav = [[HDMainNavigationController alloc] initWithRootViewController:tabBarController];
tabBarNav.navigationBarHidden = YES;
[currentViewController presentViewController:tabBarNav animated:YES completion:^{
                        AppDelegate * appdelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                        appdelegate.window.rootViewController = tabBarNav;
                    }];
看代码,猜想前同事可能想既保留跳转动画,跳转完之后,再把跳转到的界面设置为根视图,但这种写法在iOS 11系统上就出错了.
解决方式两种:1.跳转后不要再进行设置根视图操作,2.或者直接设置为根视图,不走跳转操作.
                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值