Handling return key tap with custom text input UIView

I've implemented a custom input UIView based on UILabel. It implements UIKeyInput and UITextInputTraits protocols. So it can handle input and customise keyboard type.

But how to handle keyboard return key (Done, Next, etc.) tap within this component? In other words, how does UITextField know when to call textFieldShouldReturn of its delegate?


For adding custom action when the return key is pressed:

- (void)insertText:(NSString *)theText
    if ([theText isEqualToString:@"\n"]) {
        //Here you can implement your own custom action

For setting the type of the return key:

-(UIReturnKeyType) returnKeyType
    return UIReturnKeySearch;

Need Your Help

How to remove svn folders over FTP on Windows hosting

windows svn ftp directory delete-directory

I've accidentally copied a large part of a folder tree from my SVN working copy to my shared Windows web host via FTP.

How can I serialize bash commands?


I just want to do a simple greeting: