iOS Question label.SizeToFit and .Multiline

Misterbates

Active Member
Licensed User
Just been playing with label .SizeToFit and .Multiline to be sure I understand how they work (as label sizes are very important in my latest project). Here's what I've found.

If .Multiline is false then .SizeToFit works ONLY on the text up to the first CRLF, and it doesn't matter whether .Width or .Height are set first or not, the label is sized to fit one line of text high and wide enough to fit all the text up to the first CRLF.

If .Multiline is true then .SizeToFit works differently depending on whether .Width is set first or not. If .Width is NOT set, then the label will be sized as wide as the widest "line" in the text (where CRLFs denote line breaks) and high enough to fit all the lines in. If .Width IS set first, then the text will be word-wrapped so that each line is no wider than .Width and the label will be sized as wide as the widest word-wrapped line and high enough to fit all the word-wrapped lines in. Word-wrapping prefers to line-break on whitespace, but will line-break within a word if the label is narrower than the word width).

Does this match other people's experience?
 
Top