IQKeyboardManager 导致视图上移那些事

2022-07-25  本文已影响0人  coco_CC
`问题`
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];
}

上一篇下一篇

猜你喜欢

热点阅读