Hello All ,
I am giving a text view to tweet some string .
I am applying the following method to restrict the number of characters to 140 in length.
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if([text isEqualToString:@"\b"]){
DLog(@"Ohoooo");
return YES;
}else if([[textView text] length] > 140){
return NO;
}
return YES;
}
The code is working nicely except the first condition that backspace is not working. suppose that I have reached the limit of 140 characters so that the method will give me false and the user can not insert more characters but after that when I try to delete some characters the text view behave as it is disabled .
So the question how do delete characters from textview.text
or re-enable the text view .