Edit

Bagikan melalui


UIView.AlignmentRectForFrame(CGRect) Method

Definition

Returns a customized alignment rectangle for Auto Layout.

[Foundation.Export("alignmentRectForFrame:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual CoreGraphics.CGRect AlignmentRectForFrame (CoreGraphics.CGRect frame);
abstract member AlignmentRectForFrame : CoreGraphics.CGRect -> CoreGraphics.CGRect
override this.AlignmentRectForFrame : CoreGraphics.CGRect -> CoreGraphics.CGRect

Parameters

frame
CGRect

A RectangleF for which the alignment rectangle should be calculated.

Returns

The alignment rectangle appropriate to the frame.

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 FrameForAlignmentRect(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