IQKeyboardManager Masonry, 如何解决键盘弹出时,UINavigator Bar 向上移动问题

- (void)loadView
{
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.view = scrollView;
    
    self.viewContainer = [[UIView alloc] init];
    [self.view addSubview:self.viewContainer];
    [self.viewContainer mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_greaterThanOrEqualTo(SCREEN_HEIGHT - 64);
    }];
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyBoard:)];
    [self.view addGestureRecognizer:tapGesture];
}

-(void)hideKeyBoard:(UITapGestureRecognizer *)gesture
{
    [self.view endEditing:YES];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [IQKeyboardManager sharedManager].enable = YES;
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    [IQKeyboardManager sharedManager].enable = NO;
}

你可能感兴趣的:(IQKeyboardManager Masonry, 如何解决键盘弹出时,UINavigator Bar 向上移动问题)