Home > Mobile >  Find number of characters remaining on uitextview after selecting text and tap Cut
Find number of characters remaining on uitextview after selecting text and tap Cut

Time:02-17

I have a uitextview. I have some text on it. I have a counter at the bottom right corner. 80 characters is the limit. 35 characters exist in the uitextview. If i select 5 characters and tap cut the counter at the bottom right shows 34/80 because i remove one character each time the user taps backspace. Is it possible to find the number of characters removed when user taps Cut and then update the counter to be 30/80?

CodePudding user response:

Conform your class to UITextViewDelegate and implement

- (void)textViewDidChange:(UITextView *)textView { 
    // update your counter here
}
  • Related