Need to dismiss they keyboard in a UITextView? Changing the Return key to read “Done” doesn’t make the iPhone keyboard to go away. Put this code in the delegate for your UITextView and your return key can behave more like the Done button in the keyboard for a UITextField.
#pragma mark - #pragma mark UITextViewDelegate methods - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if (range.length==0) { if ([text isEqualToString:@"n"]) { [textView resignFirstResponder]; return NO; } } return YES; }
this code dosent work…
– (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if([text isEqualToString:@”\n”]) {
[textView resignFirstResponder];
return NO;
}
return YES;
}
This should work
Yaa its working Thanks alot