Is the Label.SizeToFit function deprecated?
It is not deprecated:https://developer.apple.com/documentation/uikit/uiview/1622630-sizetofit
I tested it with:
UILabel label = new UILabel(new CGRect(0, 300, 22, 0));
label.TextColor = UIColor.Black;
label.Lines = 0;
label.Text = "this is a very long text";
And the effect:
I set its height to 0 but the actual height is automatically adjusted as I set the Lines to 0.
Please note that it won't work if you use autolayout to arrange the label.
Seeing your example and reading about sizeThatFits, I miss interpreted the intention of the function. I thought I would resize the label to the next size needed to wrap the text in the label, i.e. make it wider, not wrap the text to a specific width
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies