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{
return [[textView text] length] <= 140;
}
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 is: "How to delete characters from textview.text
or re-enable the text view?"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…