Reputation: 6164
In my iPhone App I am using the control UItextView, I want to hide the keyBoard on "return" Button itself, I am not using any toolBar,NavigationBar and I don't want to import any other control like button on that View.
What shold I do to hide keyboard ?
Please Help and Suggest,
Thanks
Upvotes: 1
Views: 2654
Reputation: 50697
You can use the shouldChangeTextInRange
delegate and look for a line break:
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)string
{
if([string isEqualToString:@"\n"]){
[textView resignFirstResponder];
}
return YES;
}
Upvotes: 4