0

Is it possible to calculate the number of Visible characters in UITextView?there is possibility that the text in textview may be more or less than the size of UITextView..so I just want to truncate the last 3 visible characters and add ellipsis.. How to do it?

user1960279
  • 494
  • 1
  • 8
  • 24

1 Answers1

0

you can do this by using UITextView Delegate -

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text

here you can check for size and truncate the text.

But i don't think this is a good idea.

saadnib
  • 11,145
  • 2
  • 33
  • 54
  • I am getting data after parsing than displayed in UITextView..I cant use this delegate.. – user1960279 Apr 10 '13 at 08:04
  • ohh.. you are using UITextField for display instead of user input. Why not UILabel ? Anyway, when you setting text of UItextView, at that time you can truncate it. – saadnib Apr 10 '13 at 08:07
  • no,i am using UITextView..firstly parsing is done and than display data in uitextview..during parsing I can get less or more data than size of UITextView..so when display , i want to show textview contain data and ellipsis both. – user1960279 Apr 10 '13 at 10:40