Modifica

Condividi tramite


UIView.SizeToFit Method

Definition

Moves and resizes the UIView so that it tightly encloses its Subviews

[Foundation.Export("sizeToFit")]
public virtual void SizeToFit ();
abstract member SizeToFit : unit -> unit
override this.SizeToFit : unit -> unit
Attributes

Remarks

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.

Applies to

See also

  • <xref:UIKit.UIView.SizeThatFits>