我已经实现了textView:shouldChangeTextInRange:replacementText:如下所示。我需要它来删除提示文本并结束编辑。我是否需要在其中添加其他内容才能关闭自动更正功能?或者我怎么把它关掉?
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if ([self.noteView.text isEqualToString:initialText]) {
textView.text = @"";
self.noteView.textColor = [UIColor blackColor]; // initialText was lightGray
} else if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
}
return YES;
}