how does UITextView delegate knows when to call textViewDidEndEditing
I am developing an application in which i need to call a particular method when user hits return button.I am using UITextView. Now the problem is that when I hit return key ,cursor goes to next line and I am not able to retrieve the action in my code. I tried to write the same code in textViewDidEndEditing: delegate method but it looks as if we cant find when and at what action this particular method is called...Can someone help in with any of开发者_JAVA技巧 above approach?
To detect the return key, you could implement the following delegate method:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
Simply check text
for a newline and proceed as desired.
精彩评论