title: iPhone restrict user from entering space in textfield
body: <p>i want to restrict user from entering space in a UITextField. for this i m using this code </p>
  
  <pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
      if ( string == @" " ){
          UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You have entered wrong input" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
          [error show];
          return NO;
      }
      else {
          return YES;
      }
  }
  </code></pre>
  
  <p>but it is not working  .... what is wrong in it ?</p>