开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜