title: Backspace not working when implementing shouldChangeCharactersInRange method - iPhone Dev
body: <p>Problem... I have a string of allowable characters "0123456789." How do I also allow the backspace from the keyboard... when I implement the code from below... the backspace key no longer works... How can I fix this?</p>
  
  <pre><code>- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 
  
      NSCharacterSet *nonNumberSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet];
  
      return ([string stringByTrimmingCharactersInSet:nonNumberSet].length &gt; 0);
  
  }
  </code></pre>