UIView.FrameForAlignmentRect(CGRect) Method


Returns the frame resulting from applying the alignmentRect to the current Auto Layout constraints.

[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual CoreGraphics.CGRect FrameForAlignmentRect (CoreGraphics.CGRect alignmentRect);
abstract member FrameForAlignmentRect : CoreGraphics.CGRect -> CoreGraphics.CGRect
override this.FrameForAlignmentRect : CoreGraphics.CGRect -> CoreGraphics.CGRect



A RectangleF for which the frame rectangle should be calculated.



The frame rectangle appropriate to the alignmentRect/



By overriding this method, application developers can fully customize the alignment rectangle of the UIView.Application developers who override this method must also override the complementary method AlignmentRectForFrame(CGRect). The two methods must provide complementary values.

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