美文网首页
IQKeyboardManager 导致视图上移那些事

IQKeyboardManager 导致视图上移那些事

作者: coco_CC | 来源:发表于2022-07-25 14:14 被阅读0次
    `问题`
    1、进入页面直接弹起输入框
    2、收回输入框后视图整体上移
    

    解决方案

    1、Appdelegate

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    IQKeyboardManager.sharedManager.enable = YES;
    }
    

    2、ViewController

    #pragma mark - Life Cycle Methods
    - (void)viewWillAppear:(BOOL)animated {
    
        [super viewWillAppear:animated];
        [[IQKeyboardManager sharedManager] setEnable:NO];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        [[IQKeyboardManager sharedManager] setEnable:YES];
    }
    
    

    相关文章

      网友评论

          本文标题:IQKeyboardManager 导致视图上移那些事

          本文链接:https://www.haomeiwen.com/subject/ucyoirtx.html