融云IMKit SDK与FDFullscreenPopGesture冲突

·  阅读 612

最近项目集成融云IMKit,发现聊天页面,选择图片-->预览--->导航栏异常,如下图

定位发现,融云RCPhotoPreviewCollectionViewController类虽然设置了隐藏导航栏,但最后被UINavigationController+FDFullscreenPopGesture覆盖了,被覆盖位置

- (void)fd_viewWillDisappear:(BOOL)animated
{
    // Forward to primary implementation.
    [self fd_viewWillDisappear:animated];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        UIViewController *viewController = self.navigationController.viewControllers.lastObject;
        if (viewController && !viewController.fd_prefersNavigationBarHidden) {
            [self.navigationController setNavigationBarHidden:NO animated:NO];
        }
    });
}
复制代码

处理方案

方法1.

修改UINavigationController+FDFullscreenPopGesture,过滤不处理融云RCPhotoPreviewCollectionViewController类导航栏

- (void)fd_viewWillDisappear:(BOOL)animated
{
    // Forward to primary implementation.
    [self fd_viewWillDisappear:animated];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        UIViewController *viewController = self.navigationController.viewControllers.lastObject;
        if (viewController && !viewController.fd_prefersNavigationBarHidden) {
            NSString *classString = NSStringFromClass(viewController.class);
            if ([classString isEqualToString:@"RCPhotoPreviewCollectionViewController"]) {return;}
            [self.navigationController setNavigationBarHidden:NO animated:NO];
        }
    });
}
复制代码

方法2.舍弃其一。

分类:
iOS
标签:
收藏成功!
已添加到「」, 点击更改