[ios] subview’s position is incorrect (auto layout)

  • Goal
    • autolayout을 사용하는 view의 subview에 non-autolayout을 사용하는 view를 넣고frame’s origin, size를 변경하여 뷰의 위치, 크기를  컨트롤 하기를 원했다.
  • Problem
    • view가 초기화 되고 난 뒤 최초 subview’s frame.origin, size가 올바로 설정되지 않는 현상을 발견 했다.
  • Solution
    • non-autolayout을 autolayout으로 컨트롤 되도록 superview’s top, leading space로 frame.origin을 대체. frame.size는 size constraint로 바꾸었다.
      constraint로 바꾸고 나서 초기화 뒤 subview’s position이 의도한 위치에 지정 되는 것을 확인 하였다.
  • Goal
    • Subview ‘s layout is not autolayout, view’s origin, size controlled by view’s frame
  • Problem
    • After  initialization of subview , subview’s frame is not correct. (was not changed)
  • Solution
    • Convert subview’s layout rule to auto-layout.