views:

23

answers:

1

I'm working on an iPhone app which involves typing stuff into a UITextView, which adds content to a UITableView. The problem is, I need to be able to close the keyboard when the user's done with it, and the only area that is really visible other than the keyboard and UITextView at this point is the UITableView. I'm having trouble implementing a touch event on the UITableView (as in, touching the UITableView anywhere, not just didSelectRowAtIndexPath:). Here's the code I'm using in the view controller, which doesn't do anything at all:

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
 [textView resignFirstResponder];
}

Any suggestions?

A: 

That looks like correct code to me. Put a breakpoint in to make sure it's being called.

Matt Williamson