In my application am using UITextView in UIScrollView,I added the code to to hide ,it is not working.Here my code
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if([text isEqualToString:@"\n"])
[txt1 resignFirstResponder];
return YES;
}
Your code is okay. Just replace
with
And make sure your
textViewdelegate is set to beYESother wisedelegatemethod would not be call.If you have been taken your
textViewfromXIBthen ctrl+drag fromtextViewtoFile'sO Ownerand set itsdelegate. It would work for sure.