UIView. ToFit Size
[Foundation.Export("sizeToFit")] public virtual void SizeToFit ();
abstract member SizeToFit : unit -> unit override this.SizeToFit : unit -> unit
Calling this method resizes the UIView so that it just encloses its subviews. Some UIView that do not have their Superview property set resize themselves to the screen bounds, so application developers should generally make sure that they have assembled an appropriate view hierarchy before calling SizeToFit().
Application developers should not override this method. Instead, application developers should override SizeThatFits(CGSize), which this method will call.