How to check the character is backspace (delete)


- (BOOL) textField:(UITextField *) textField
shouldChangeCharactersInRange:(NSRange) range
            replacementString:(NSString *) string
{
     if ([string length])
     {
          if ([string characterAtIndex:0] == 10)
          {
               NSLog(@"keyboard backspace pressed");
          }
      }
      return YES;
}

Blogged with the Flock Browser
Advertisements

2 Responses to “How to check the character is backspace (delete)”

  1. Andrei Says:

    Try that when the text field is empty…

  2. praveenmatanam Says:

    For iOS 7

    if ([string isEqualToString:@””])
    {
    NSLog(@”keyboard backspace pressed”);
    }


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: