UIView.AlignmentRectInsets Property


Adjustments to the Frame for use with Auto Layout.

[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[get: Foundation.Export("alignmentRectInsets")]
[get: ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual UIKit.UIEdgeInsets AlignmentRectInsets { get; }
member this.AlignmentRectInsets : UIKit.UIEdgeInsets

Property Value

The default value is an UIEdgeInsets whose values are all zero.



Application developers can use this property to modify the rectangle that is used by Auto Layout to control the UIView's ultimate alignment.

Auto Layout uses "alignment rectangles" to layout subviews rather than the subviews' Frame. The Frame of a UIView may include visual elements, such as drop-shadows, that are not symmetrical around the UIView's logical center. The "alignment rectangle" for a UIView should be related to its logical content.

By default, the "alignment rectangle" of a UIView is the Frame plus the AlignmentRectInsets. The AlignmentRectForFrame(CGRect) and FrameForAlignmentRect(CGRect) methods can be used to fully customize the alignment rectangle.

Applies to

See also

  • <xref:UIKit.UIView.AlignmentRectForFrame>
  • <xref:UIKit.UIView.FrameForAlignmentRect>
  • ViewForBaselineLayout