0

I need to help for showing limited text in UITextView

Currently i get text from server which is more than 1000 characters.But i need to display only 250 characters and ... at the end in UItextView.Also I have disable edit more in UITextView. So what's the best way to implement this

Thanks in advance

Hiren
  • 12,720
  • 7
  • 52
  • 72

2 Answers2

0

you can register for UITextViewTextDidChangeNotification and trim the string received only to 250 characters if it is greater than 250 characters. You can disable editing the text view from IB.

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115
0

You can do like as :

   UITextView *your_txtView;

if ([YourServerString length]>=250) {


    YourServerString = [[YourServerString substringToIndex:249] stringByAppendingString:@"..."];



}
your_txtView.userInteractionEnabled = NO;
your_txtView.text = YourServerString;
Sham
  • 475
  • 2
  • 7