iOS 使用IQKeyboardManager出现导航栏电池条变白、变透明问题处理

方法就是找到IQKeyboardManager框架中IQUIView+Hierarchy.m文件,修改 -(UIViewController *)topMostController 方法中的代码代码如下。

- (UIViewController *)topMostController
{
    UIViewController  *rootController = [UIApplication  sharedApplication].keyWindow.rootViewController;
    if ([rootController isKindOfClass:[UITabBarController class]]) {
        UITabBarController *tabBarController = (UITabBarController *)rootController;
        UINavigationController *navController = tabBarController.selectedViewController;
        UIViewController *viewController = (UIViewController *)navController.visibleViewController;
        while (viewController.presentedViewController) {
            viewController = (UIViewController *)viewController.presentedViewController;
        }
        return viewController;
    } else if ([rootController isKindOfClass:[UINavigationController class]]) {
        UINavigationController *navController = (UINavigationController *)rootController;
        return navController.visibleViewController;
    } else if ([rootController isKindOfClass:[UIViewController class]]) {
        return rootController;
    } else {
        return nil;
    }
}

你可能感兴趣的:(iOS 使用IQKeyboardManager出现导航栏电池条变白、变透明问题处理)