IQKeyboardManager使用TextView导致系统导航栏上升的问题

1 :在页面出现时关闭第三方  页面消失时再打开 单独在这个页面处理  监听 UIKeyboardWillShowNotification和UIKeyboardWillHideNotification  处理textview的frame的常规做法  
如:////监听键盘将要出现

//- (void)keyboardWillShow: (NSNotification*)notification

//{

//    CGRect keyBoardFrame = [[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

//    [UIView animateWithDuration:0.3 animations:^{

//        self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y - keyBoardFrame.size.height,self.frame.size.width, self.frame.size.height);

//    }];

//}

//

////监听键盘将要消失

//- (void)keyboardWillHide: (NSNotification*)notification

//{

//    [UIView animateWithDuration:0.3 animations:^{

//        self.frame = 之前的frame//    }];

//}



2:  第二种做法比较简单 针对高版本的IQKeyboardManager  
 系统搜索IQUIView+Hierarchy.h文件里的-(UIViewController*)topMostController方法
把里面的代码替换成

```

- (UIViewController*)topMostController

{

    UIViewController*topController =self.window.rootViewController;

    if([topControllerisKindOfClass:[UITabBarControllerclass]]){

        UITabBarController*tabbarController = (UITabBarController*)topController;

        topController = tabbarController.selectedViewController;

        if([topControllerisKindOfClass:[UINavigationControllerclass]]){

            UINavigationController*navController = (UINavigationController*)topController;

            topController = navController.visibleViewController;

        }

    }

    while ([topController presentedViewController])

    {

        topController = [topControllerpresentedViewController];

    }

    returntopController;

}

```

就可以了  会引出一些问题  但是一般情况下碰不到  如果有碰到了的朋友可以留言给我一起讨论下。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容