title: UItextView delegate not called using custom keyboard
body: <p>I have several UITextView subviews, all using the same custom input interface (basically a numberpad with an autofill-option and a save button).</p>
  
  <p>My problem is that the delegate method shouldChangeCharactersInRange: is not called when the textfield's text is modified from my custom keyboard (it does work when pasting text from clipboard into the textfields and also when using the standard numberpad keyboard). The text of the textfields change, but the delegate method to prevent invalid entries is not called. Other delegate methods of style DidBeginEditing: are called always.</p>
  
  <p>despite of what is said in this <a href="https://stackoverflow.com/questions/8917172/uitextview-delegate-never-called">SO LINK</a> the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html#//apple_ref/doc/uid/TP40006897-CH3-SW" rel="nofollow noreferrer">documentation</a> states that the shouldChangeCharactersInRange: delegate method will be called: "The text view calls this method whenever the user types a new character or deletes an existing character." </p>
  
  <p>What am I missing?</p>
  
  <p>relevant code parts:</p>
  
  <p>ViewController.h:</p>
  
  <pre><code>@interface ManualPositionViewController : UIViewController &lt;UITextFieldDelegate&gt; {
      LocationEntryTextField *latitude;
  }
  @property (nonatomic, retain) IBOutlet LocationEntryTextField *latitude;
  @property (nonatomic, retain) IBOutlet LocationKeyboard *locationKeyboard;
  ..
  </code></pre>
  
  <p>ViewController.m:</p>
  
  <pre><code>@synthesize latitude;
  @synthesize locationKeyboard;
  self.latitude.inputView = locationKeyboard;
  self.latitude.delegate = self;
  
  - (void)textFieldDidBeginEditing:(LocationEntryTextField *)aTextField {
  
      NSLog(@"textFieldDidBeginEditing called!");
      self.locationKeyboard.currentTextfield = aTextField;
  }
  
  - (BOOL)textField:(LocationEntryTextField *)editedTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString {
  
      NSLog(@"shouldChangeCharactersInRange called!");
      NSCharacterSet *decimalSet = [NSCharacterSet decimalDigitCharacterSet];
  
      if ([[replacementString stringByTrimmingCharactersInSet:decimalSet] isEqualToString:@""]) { 
          NSLog(@"Result: YES");
          return YES;
      }
      else {
          NSLog(@"Result: NO");           
          return NO;
      }
  }
  </code></pre>
  
  <p>LocationKeyboard.h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "LocationEntryTextField.h"
  
  @interface LocationKeyboard : UIView {
      LocationEntryTextField  *currentTextfield; // track first responder
  }
  @property (weak) LocationEntryTextField *currentTextfield;
  - (IBAction) numberButtonPressed:(UIButton*)sender;
  - (IBAction) backspaceButtonPressed:(UIButton*)sender;
  @end
  
  - (IBAction) numberButtonPressed:(UIButton*)sender {
      NSString *entryString = @"test";
      [self.currentTextfield replaceRange:self.currentTextfield.selectedTextRange withText:entryString];
  }
  </code></pre>
  
  <p>LocationEntryTextField.h:</p>
  
  <pre><code>@interface LocationEntryTextField : UITextField
  ..
  </code></pre>