Edit

Bagikan melalui


UIView.FrameForAlignmentRect(CGRect) Method

Definition

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

[Foundation.Export("frameForAlignmentRect:")]
[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

Parameters

alignmentRect
CGRect

A RectangleF for which the frame rectangle should be calculated.

Returns

The frame rectangle appropriate to the alignmentRect/

Attributes

Remarks

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