UITextView类隐藏系统键盘 Objective-C
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { if (text isEqualToString:@“\n”) { return NO; } else { return YES: } }复制代码
Swift
func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool { if text == "\n" { return false } return true }复制代码