You need to assign the UITextField's delegate to whatever is the parent of the UITextField. Then use the delegate function that corresponds to whether or not to use the Return key and in that function return YES and resign the first responder.
I'm not 100% sure of the concept of first responders though, I just know it needs to be done...