numberOfLines in UITextview?
UIlabel has numberOfLines property. It says my string has 2 lines. But when I use UItextview , I want to split the number of lines based on length of text in UITextview. How can I do 开发者_开发问答it? UIlabel automatically splits, but UITextview does not do it.
The lines should be separated by "\r"
Here's an example:
lblNeedSubscription = [[UILabel alloc] initWithFrame:frame];
[lblNeedSubscription setNumberOfLines:0]; // allows as many lines as needed
[lblNeedSubscription setText:@"To access content\ryou need to be a paid subscriber"];
UITextView inherently allows multiple lines of text. You just separate your lines with the "/n" character and you're done.
精彩评论