开发者

shrinking text in UILabel

i hv a label of width 100 px,but dynamically i am filling that label. so the text's length is not fixed, so it can be anything, 10 or 30. the problem i am facing is, when the text length exceeds, the font size of the text in UIlabel gets smaller and complete text comes up in uilabel.

i was trying if, the text length gets exceeds, it should show something like this "abcdefghijklm" to "开发者_C百科abc...."

with the same font size...something like adjust size to fit . how can do dat?

regards


set label property

yourLabelName.adjustsFontSizeToFitWidth = NO;


You can use adjustsFontSizeToFitWidth property for the same size of frame for your label. but if you need to show the label contents in the same font size then you can use this thing:

labelname.numberofLine=0;

And you can change the font hight accordingly so that your label contents will set in proper format with the required font size.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜