I\'m having real trouble getting my head around this issue.
As the title suggests, I have several UITextViews on a view in an iPhone application. I am programmatically c
You can do a character count. For example, if you have UITextField like this:
+--------------------+
|This is a string in |
|a text view. |
+--------------------+
you have something like 20 characters per line. If you know that number you can simply truncate your string by -substringToIndex:
method.
int maxCharacters = 40; // change it to your max
if([myString length] > maxCharacters) {
myString = [myString substringToIndex:maxCharacters];
}
You can also think about UILabel
. Since you need only 2 lines of text, UILabel's numberOfLines
property can solve your problem.