Disable keyboard for UITextView without using back key
5 answers
Many people add a UIToolbar with a button Doneon it above the keyboard. This is how the Safari app does it, and in my opinion, this is the best way to handle this situation. See here .
To undo the keyboard you just have to do [textField resignFirstResponder];.
Here's a good example of how to add a UIToolbar when the keyboard is showing / hiding.
+8
source to share
Make sure you have declared support for the UITextViewDelegate protocol.
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText: (NSString *)text
{
if([text isEqualToString:@"\n"])
{
[textView resignFirstResponder];
return NO;
}
return YES;
}
Enjoy Friend with this code ....
0
source to share