AMapNavi
一次项目中,需要用到高德导航,APP中集成,并非跳转第三方客户端
当我集成好高德SDK准备跳转,测试结果很意外,导航栏被遮住了;
我一遍遍查看我的代码,没毛病呀!
跑到Podfile里一看,原来是你这个家伙---->FDFullscreenPopGesture
这个右滑返回组建是全局,当跳转到高德地图的时候,依然设置第三方,而高德SDK又有自己的导航栏,因为层次关系,导致系统导航栏覆盖了SDK的导航栏;
解决
在UINavigationController+FDFullscreenPopGesture.m更改137行代码方法
- (void)fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:(UIViewController *)appearingViewController
{
if (!self.fd_viewControllerBasedNavigationBarAppearanceEnabled) {
return;
}
__weak typeof(self) weakSelf = self;
_FDViewControllerWillAppearInjectBlock block = ^(UIViewController *viewController, BOOL animated) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (strongSelf) {
if ([NSStringFromClass([appearingViewController class]) hasPrefix:@"AMapNavi"]) {
[strongSelf setNavigationBarHidden:YES animated:animated];
} else {
[strongSelf setNavigationBarHidden:viewController.fd_prefersNavigationBarHidden animated:animated];
}
}
};
// Setup will appear inject block to appearing view controller.
// Setup disappearing view controller as well, because not every view controller is added into
// stack by pushing, maybe by "-setViewControllers:".
appearingViewController.fd_willAppearInjectBlock = block;
UIViewController *disappearingViewController = self.viewControllers.lastObject;
if (disappearingViewController && !disappearingViewController.fd_willAppearInjectBlock) {
disappearingViewController.fd_willAppearInjectBlock = block;
}
}
好啦,完美解决
网友评论