본문 바로가기
iOS 🍎/iOS

translatesAutoresizingMaskIntoConstraints 속성

by yongmin.Lee 2022. 2. 23.

translatesAutoresizingMaskIntoConstraints

  • A Boolean value that determines whether the view’s autoresizing mask is translated into Auto Layout constraints.
  • If this property’s value is true,
    • the system creates a set of constraints that duplicate the behavior specified by the view’s autoresizing mask.
    • This also lets you modify the view’s size and location using the view’s framebounds, or center properties, allowing you to create a static, frame-based layout within Auto Layout.
    • frame based인 autoreszing mask를 auto layout에서 사용할 수 있게 한다
  • If this property’s value is false,
    • you must provide a non ambiguous, nonconflicting set of constraints for the view then you can use Auto Layout to dynamically calculate the size and position of your view 
  • By default, the property is set to true for any view you programmatically create.
  • Note that the autoresizing mask constraints fully specify the view’s size and position; therefore, you cannot add additional constraints to modify this size or position without introducing conflicts. 

 

  • translatesAutoresizingMaskIntoConstraints의 값이 true이면 시스템은 View의 autoresizing  mask로 지정된  Constraint집합을 만든다. 이때 View의  frame, bounds 또는 center프로퍼티를 사용하여 View의 크기와 위치를 수정하여 auto layout에서 정적인 프레임 기반 레이아웃을 만든다. => static
  • autoresizing mask constraint을 통해 View의 크기와 위치를 완전히(fully specify) 지정하므로 이 크기 또는 위치를 수정하기 위해 constraint를 추가 할 수 없다!. 
  • auto layout을 사용하여 View의 크기와 위치를 동적으로 계산하려면, 이 프로퍼티를 false로 설정 한 다음, View에 모호(ambiguous)하지 않고 충돌하지 않는(nonconflicting) constraint집합을 제공해야 한다. => dynamic

.

 

 

참고자료 

https://developer.apple.com/documentation/uikit/uiview/1622572-translatesautoresizingmaskintoco

https://jisoo.net/2018/03/02/UIView-translatesAutoresizingMaskIntoConstraints.html

https://zeddios.tistory.com/474

'iOS 🍎 > iOS' 카테고리의 다른 글

iOS File System = SandBox 구조  (0) 2022.03.04
Frame-base layout vs Auto layout  (0) 2022.03.02
Main Run Loop & Update Cycle  (0) 2022.01.24
Notification Service Extension  (0) 2021.12.06
App Extension  (0) 2021.12.06