UITextView resignFirstResponder while pressing Return

- (BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    BOOL isPressingReturn = [text isEqualToString:@"\n"];
    if(isPressingReturn){
        [textView resignFirstResponder];
        return NO;
    }else{
        return YES;
    }
}

你可能感兴趣的:(UITextView)