title: textFieldShouldEndEditing called multiple times
body: <p>I am working on a view that has multiple <code>UITextField</code> objects.  My view controller serves as the <code>UITextFieldDelegate</code>, and I've implemented the <code>(BOOL)textFieldShouldEndEditing:(UITextField *)textField</code> method to save and validate the record being displayed.</p>
  
  <p>If the user clicks on the "Done" button after editing an item and the save/validate fails, then a <code>UIAlertView</code> is displayed and the user is kept on the <code>UITextField</code> that fails validation.</p>
  
  <p>My problem is this -- when a user clicks from the <code>UITextField</code> that will fail save/validation onto another of the <code>UITextField</code>s, then the <code>(BOOL)textFieldShouldEndEditing:(UITextField *)textField</code> method is called multiple times, and the <code>UIAlertView</code> pops up multiple times.</p>
  
  <p>Why is <code>(BOOL)textFieldShouldEndEditing:(UITextField *)textField</code> called once when the user clicks "Done" on the keyboard, but called multiple times when the user clicks onto another <code>UITextField</code>?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
      NSLog(@"textFieldShouldEndEditing called by textField with text=%@", textField.text);
  
      currentItem.nameOrNumber = nameOrNumber.text;
  
      // Try to save the managed object.
      NSError *error = nil;
      if (![[currentItem managedObjectContext] save:&amp;error]) {        
          UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Uh Oh!",@"")
                                                               message:[error localizedDescription]
                                                              delegate:self
                                                     cancelButtonTitle:NSLocalizedString(@"OK",@"")
                                                     otherButtonTitles:nil];
          [errorAlert show];
          [errorAlert release];
          shouldEnd = NO;
      }
  
      return shouldEnd;
  }
  </code></pre>