UIView.GetConstraintsAffectingLayout(UILayoutConstraintAxis) 메서드

정의

지정된 를 따라 의 NSLayoutConstraint 레이아웃에 영향을 주는 의 UIView 배열을 axis반환합니다.

[Foundation.Export("constraintsAffectingLayoutForAxis:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual UIKit.NSLayoutConstraint[] GetConstraintsAffectingLayout (UIKit.UILayoutConstraintAxis axis);
abstract member GetConstraintsAffectingLayout : UIKit.UILayoutConstraintAxis -> UIKit.NSLayoutConstraint[]
override this.GetConstraintsAffectingLayout : UIKit.UILayoutConstraintAxis -> UIKit.NSLayoutConstraint[]

매개 변수

axis
UILayoutConstraintAxis

관심 방향입니다.

반환

기본값은 빈 배열입니다.

특성

설명

프로덕션 애플리케이션에서 사용해서는 안 되는 디버깅 방법입니다.

반환된 배열에는 명시적으로 참조UIViewthis하지 않지만 에 영향을 주는 가 Frame포함될 NSLayoutConstraint수 있습니다. 예를 들어 가 에 고정되고 anotherViewanotherViewSuperview고정된 경우 this 메서드는 두 제약 조건을 모두 반환할 수 있습니다.

이 메서드는 디버깅 지향 도우미 메서드이며 전체 집합(또는 모든) NSLayoutConstraint을 반환하도록 보장되지 않습니다.

이 메서드가 내에서 ViewDidLoad()직접 호출되는 경우 일반적으로 빈 배열을 반환합니다. 다음 예제와 같이 호출되는 경우 포괄적인 답변을 제공할 가능성이 더 높은 것으로 보입니다.

mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[blue]-|", 0, new NSDictionary(), viewsDictionary));
mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[blue]-(==30)-[green(==blue)]-|", 0, new NSDictionary(), viewsDictionary));
mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("|-[green(==blue)]-|", 0, new NSDictionary(), viewsDictionary));

System.Threading.ThreadPool.QueueUserWorkItem(delegate {
  InvokeOnMainThread(delegate {
    foreach(var c2 in blueView.GetConstraintsAffectingLayout(UILayoutConstraintAxis.Horizontal))
    {
      Console.WriteLine(c2);
    }
  });
});

적용 대상