Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: xikky on July 20, 2013, 04:50:42 AM

Title: Limit LabelWidth + replace exceeded char with "..."
Post by: xikky on July 20, 2013, 04:50:42 AM
Sorry for the simple question, but I want to limit a label to a certain size and if the string exceeds the limited size I would like to add a "..." at the end of the string. I know that to limit a label size I just have to set MaxWidth in the inspector, but how would I know that the limited size is exceeded to replace the exceeding characters and add the "..." to the Label.text?

Thank you!
Title: Re: Limit LabelWidth + replace exceeded char with "..."
Post by: ArenMook on July 20, 2013, 03:03:35 PM
You would need to compare UIFont.CalculatePrintedSize(original text) to UIFont.CalculatePrintedSize(uiLabel.processedText).