views:

18

answers:

1

I want to show the number of characters left for a new tweet, after a key has been lifted. Currently, this only happens if return is lifted:

- (IBAction)updateCharacterCountFromNewTweetField:(id)sender {
  [newTweetCharacterCount setIntValue:140 - [[sender stringValue] length]];
}

This action is connected to an NSTextField (NOT A UITextField!!): alt text

This is terrible for users, because they want to see the character count immediately, not just after pressing return.

Can anyone help me out? Thanks.

+1  A: 

Set a delegate on the textfield and have it implement the controlTextDidChange: delegate method.

See also Text Editing Programming Guide: Delegate Messages and Notifications.

Nathan Kinsinger
Ooh, stupid me. Why didn't I think of a delegate. >.< THANKS :'D
Time Machine