You're headed in the wrong direction here, because you're already using a custom keyboard. That should eliminate you from needing to use a UITextFieldDelegate to solve the problem of return key detection.
textFieldShouldReturn: is a delegate method of the UITextField used to detect when the user presses the return key. If you didn't have this method, you'd have to use textField:shouldChangeCharactersInRange:replacementString: to detect the newline character from a normal UIKeyboard, which would be a pain in the butt.
But if you have a particular button on your keyboard that should do something special, just wire that button up to your IBAction method directly.
So something like this:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[self returnKeyPressed:textField];
return NO;
}
- (IBAction)returnKeyPressed:(id)sender {
// Do whatever you want done
}
If you wire your custom key to returnKeyPressed:, both a hardware keyboard and your virtual custom keyboard would end up in returnKeyPressed: and the behavior would be consistent.
You probably would want to define a small protocol to make sure your delegates support returnKeyPressed: in addition to the UITextFieldDelegate methods.