UIView.AutoresizingMask UIView.AutoresizingMask Property


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

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

Property Value


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