Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: loop on June 03, 2013, 04:12:59 PM
-
Hello!
I need the current line count of a label(with a max width). I tried (int)UIFont.CalculatePrintedSize(text).y; but y is always one, even though the label has two lines. I'm using NGUI 2.6.1e.
Thanks for help!
-
CalculatePrintedSize return the size of the text, and you should multiply the size of the font to get the how much pixels does it takes. like (int)(UIFont.CalculatePrintedSize(text).y* font.size)
-
in my case i look at the relativeSize.y the y return the number of line
-
Thanks eddieB relativeSize.y works :-)
-
how can i get the total number of lines which will be required to show the label if it is limited with max line count.
i will try and explain this more suppose i have a label which has suppose 40 lines, now to make label look small i set the Max Line var for this label to lets say 5.
So now only 5 lines are visible, now i add a see more button, on clicking which the label should get bigger and show all the lines.
How can this be achieved ?
-
Just count instances of '\n' in the UILabel.processedText