Take the 2-minute tour ×

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

share|improve this question
add comment

2 Answers

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.

share|improve this answer
can you give some example please? –  Hiren Sep 30 '12 at 5:39
I don't have access to MAC right now.. so can't give you code... This notification is fired just after the text in textview changes so you can change it just after that, it pretty basic stuff. –  Ankit Srivastava Sep 30 '12 at 5:50
i have tried but it's not called stackoverflow.com/questions/1328638/placeholder-in-uitextview –  Hiren Sep 30 '12 at 5:53
placeholder is something else... what are you trying to do...? –  Ankit Srivastava Sep 30 '12 at 5:56
i get the txt from server and i just place the text like placeTxt.text = [listDict objectForKey:@"desc"]; –  Hiren Sep 30 '12 at 5:59
show 2 more comments

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;
share|improve this answer
add comment

Your Answer


