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

问题: IQ 键盘上移概率性的状态栏变成白色

解决方法: 找到 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;

    }

}


转自:https://blog.csdn.net/weixin_34414650/article/details/86884946

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