键盘回收(text filed,textview)
键盘回收
#pragma mark - TextField 代理方法 - (BOOL)textFieldShouldReturn:(UITextField *)textField { [self.view endEditing:YES]; return YES; } #pragma mark - TextView 代理方法 - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{ _scrollView.frame = CGRectMake(0, -100, JX_SCREEN_WIDTH, SCREEN_HEIGHT-SafeAreaTopHeight); return YES; } - (void)textViewDidBeginEditing:(UITextView *)textView{ _scrollView.frame = CGRectMake(0, SafeAreaTopHeight, JX_SCREEN_WIDTH, SCREEN_HEIGHT-SafeAreaTopHeight); } -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { if ([text isEqualToString:@"\n"]) { [self.beizhuTextView resignFirstResponder]; return NO; } return YES; }