vanilladocs
vanillapunch.com
API / ui/autolayout/layoutpriority

ui/autolayout/layoutpriority

레이아웃 우선순위. (UIKit 의 UILayoutPriority 와 같은 사상)

Layout priority. (Same concept as UIKit's UILayoutPriority)

LayoutPriority

짝Counterpart: vanilla-engine LayoutPriority

레이아웃 우선순위. (UIKit 의 UILayoutPriority 와 같은 사상)

  • required (1000): 반드시 만족해야 하는 우선순위. LayoutStrength.required 로 매핑.
  • defaultHigh (750): 기본 압축 저항 (compression resistance) 우선순위.
  • defaultLow (250): 기본 hug 우선순위.
  • fittingSizeLevel (50): systemLayoutSizeFitting 호출 시 권장 크기 우선순위.
  • 1 ~ 999 의 값은 LayoutStrength.fromPriority 를 통해 medium tier 로 매핑된다.

Layout priority. (Same concept as UIKit's UILayoutPriority)

  • required (1000): priority that must be satisfied. Maps to LayoutStrength.required.
  • defaultHigh (750): default compression resistance (compression resistance) priority.
  • defaultLow (250): default hug priority.
  • fittingSizeLevel (50): recommended size priority when calling systemLayoutSizeFitting.
  • Values of 1 ~ 999 map to the medium tier through LayoutStrength.fromPriority.
예제Example우선순위를 UINode 에 주고 강도로 바꾸기Give priorities to a UINode and convert one to a strength
import { UINode, LayoutPriority, LayoutStrength, LayoutConstraintAxis } from "./build/vanilla.js";

const label = new UINode();
label.setContentCompressionResistancePriority(LayoutPriority.required, LayoutConstraintAxis.horizontal);
label.setContentHuggingPriority(LayoutPriority.defaultLow - 1, LayoutConstraintAxis.horizontal);
const strength = LayoutStrength.fromPriority(LayoutPriority.defaultHigh);
console.log(strength);
정적staticstatic required = 1000#0.2.1 부터since 0.2.1소스source

표준 우선순위 상수.

Standard priority constants.

반환Returnsnumber

짝Counterpart: vanilla-engine LayoutPriority.REQUIRED

정적staticstatic defaultHigh = 750#0.2.1 부터since 0.2.1소스source

기본 압축 저항 우선순위. (750, UINode 의 압축 저항 기본값)

Default compression resistance priority. (750, the UINode compression resistance default)

반환Returnsnumber

짝Counterpart: vanilla-engine LayoutPriority.DEFAULT_HIGH

정적staticstatic defaultLow = 250#0.2.1 부터since 0.2.1소스source

기본 hugging 우선순위. (250, UINode 의 hugging 기본값)

Default hugging priority. (250, the UINode hugging default)

반환Returnsnumber

짝Counterpart: vanilla-engine LayoutPriority.DEFAULT_LOW

정적staticstatic fittingSizeLevel = 50#0.2.1 부터since 0.2.1소스source

맞춤 크기 우선순위. (50, UIKit 과 같은 값이고 엔진 안에서 쓰는 곳은 없다)

Fitting size priority. (50, the same value as UIKit, not used anywhere in the engine)

반환Returnsnumber

짝Counterpart: vanilla-engine LayoutPriority.FITTING_SIZE_LEVEL