Skip to content

Instantly share code, notes, and snippets.

@blankyao
Created February 23, 2012 04:21
Show Gist options
  • Save blankyao/1890139 to your computer and use it in GitHub Desktop.
Save blankyao/1890139 to your computer and use it in GitHub Desktop.
在UITextView里面响应return键
#pragma -
#pragma UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (range.length != 1 && [text isEqualToString:@"\n"]) {//按下return键
//TODO 做你想做的
return NO;
} else {
return YES;
}
}
@GordonQian
Copy link

Thank you for your method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment