I am developing an application in which i need to call a perticular 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 retrive 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 perticular method is called...Can someone help in with any of above approach?
A:
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.
Scott McCammon
2010-06-10 19:55:01