i want to count the characters in a textview which are typed in by the user. I gave it some thoughts and my ideas were that I have to create a NSTimer with a selector which checks the length.
So I’ve got:
-(void)viewDidLoad { [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(checkText) userInfo:nil repeats:YES]; }
-(void)checkText {
int characters;
label.text.length = self.characters;
characterLabel.text = [NSString stringWithFormat:@"%i", characters]; }
This doesn’t work because “Request for member “characters” in something not a structure or union”
How can I solve this problem?
There is no need for NSTimer. Setup yourself as textview’s delegate and implement: