title: How to implement a simple 'live' word count in a UITextView
body: <p>I'm trying to implement a simple char count of an UITextView while the user is typing in text (i.e. it should update continuously).</p>
  
  <p>I have two problems.</p>
  
  <p>(1) The first is that I don't know in which method I should put my charCount method. textViewShouldBeginEditing doesn't work, as it simply asks if an editing session should begin. textView:shouldChangeTextInRange doesn't work either, as it again asks if it is permitted to begin editing. I couldn't find other useful methods in the Apple doc.</p>
  
  <p>(2) Next problem: I tried to call my charCount method from within another method. But I get the compiler error: 'ViewController' may not respond to 'charCount'.</p>
  
  <p>Here is my humble attempt: </p>
  
  <pre><code>- (IBAction)charCount:(id)sender {
  
  // all chars
  int charsAsInt = (int)(textView.text.length);
  NSString *newText = [[NSString alloc] initWithFormat:@"All chars: %d", charsAsInt];
  allCharacters.text = newText;
  [newText release];}
  
  - (BOOL)textViewShouldBeginEditing:(UITextView *)aTextView {
  
      [self charCount];}
  </code></pre>
  
  <p>I guess it has to do with me trying to call a IBAction defined method that this won't work. But what would be the proper way to call a IBAction method from within a non-IBAction method?</p>
  
  <p>As always, I'm sorry for these very basic questions and I do appreciate every little help to get my beginner's mind around this.</p>