Add an observer in viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(textViewKeyPressed:) name: UITextViewTextDidChangeNotification object: nil]; and then use the selector to check for "\n"
-(void) textViewKeyPressed: (NSNotification*) notification { if ([[[notification object] text] hasSuffix:@"\n"]) { [[notification object] resignFirstResponder]; } } It does use "\n" and not specifically check for a return key, but I think this is OK.
UPDATE
See ribto's answer below which uses [NSCharacterSet newlineCharacterSet] in place of \n