This following example is a small character counter that can keep track of the number of characters in a text view that needs to be limited to a maximum amount of characters.


//Only check if text field has been altered
-(void)textViewDidChange:(UITextView *)textView{
    //500 chars max 
    if([[textView text] length] > 500){
        //If max reached close keypad        
        [textView resignFirstResponder];
        //Append off extra chars       
        textView.text = [textView.text substringToIndex:500];
    }
    //Count and display amount of chars left
    CounterBoxLabel.text = [NSString stringWithFormat:@"Characters left: (%i)", 500 - [[textView text] length]]; 
}