title: Format currency with UITextField
body: <p>I have a <code>UITextField</code> that the user will enter an amount of money. I want to set it so it will show the users current currency. I could do the following:</p>
  
  <pre><code>- (void)textFieldDidEndEditing:(UITextField *)textField {
  
      NSNumberFormatter *currencyFormatter = [[[NSNumberFormatter alloc] init] autorelease];
      [currencyFormatter setLocale:[NSLocale currentLocale]];
      [currencyFormatter setMaximumFractionDigits:2];
      [currencyFormatter setMinimumFractionDigits:2];
      [currencyFormatter setAlwaysShowsDecimalSeparator:YES];
      [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
  
      NSNumber *someAmount = [NSNumber numberWithDouble:[textField.text doubleValue]];
      NSString *string = [currencyFormatter stringFromNumber:someAmount];
  
      textField.text = string;
  }
  </code></pre>
  
  <p>That works. But I want it to show on startup, and while the user is typing the amount. The above code only works when the user is finished with that textField. How can I make the code in that method to show on startup and while the user is entering numbers.</p>
  
  <p>I tried to change the method to <code>shouldChangeTextInRange</code>, but it gives a weird effect.</p>