How text length of a UITextView can be fixed?

Replace (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string with (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text which is answered here.

Replace - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string with - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text which is answered here.

This chunk of code also works with Copy/Paste, but also cope with situation when trying to paste number of characters that will make the text view exceed the limit. In that case, only first characters of the string are pasted. - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { NSUInteger newLength = (textView.text.

Length - range. Length) + text. Length; if(newLength Length - range.

Length); textView. Text = textView. Text substringToIndex:range.

Location stringByAppendingString:text substringToIndex:emptySpace stringByAppendingString:textView. Text substringFromIndex:(range. Location + range.

Length); return NO; } }.

A superior solution – kevinlawler May 26 at 20:37.

You can see a similar question here. It has got the answer.

NSUInteger newLength = (textView.text. Length - range. Length) + text.

NSUInteger emptySpace = MAX_LENGTH - (textView.text. Length - range. Text = textView.

Location + range.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions