Düzenle

Aracılığıyla paylaş


UIView.AutoresizingMask Property

Definition

A bitmask that specifies how the receiver should resize itself when its super-view's bounds change.

public virtual UIKit.UIViewAutoresizing AutoresizingMask { [Foundation.Export("autoresizingMask")] get; [Foundation.Export("setAutoresizingMask:")] set; }
member this.AutoresizingMask : UIKit.UIViewAutoresizing with get, set

Property Value

The default value is None.

Attributes

Remarks

Application developers may wish to use the more powerful Auto Layout capability rather than the older Autoresizing Mask capability.

The AutoresizingMask is a powerful feature that handles a good deal of the complexity of resizing views, such as occurs during device rotation. However, it is not necessarily a complete solution. For instance, when using a UIScrollView, logic may require the ContentSize to be resized. In such situations, application developers may subscribe to the UIDeviceOrientationDidChangeNotification and implement a custom method with additional resizing logic:

//During initialization, subscribe to orientation changes              
NSNotificationCenter.DefaultCenter.AddObserver ("UIDeviceOrientationDidChangeNotification", DeviceRotated);

protected void DeviceRotated (NSNotification notification)
{
    //Code to resize UIScrollView.ContentSize and other custom on-rotation logic
}

Applies to

See also

  • <xref:UIKit.UIView.AutoResizingMask>