UITableView를 컨테이너뷰에 넣어서 사용할때 발생하는 warning 관련 문의 드립니다~

2 답변 글타래를 보이고 있습니다
  • 글쓴이
    • 종호
      참가자
      • 글작성 : 9
      • 답글작성 : 2

      Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window.

       

      table view를 container view에 넣어서 사용을 하고 있는데 container view의 constraint layout을 설정하고 ~.layoutIfNeeded() 를 수행할때 위의 warning 메시지가 뜨고 있습니다.

      이해를 해보면 table view의 layout이 제대로 잡히지 않은 상태에서 상위 뷰인 container view의 layout를 조절해서 그런것 같은데 table view의 layout의 문제가 없는것 같고 구글링을 해봐도 비슷한 사례가 없고 항상 저렇게 warning 메시지 한줄만 표시되어 문제를 찾는데 어려움을 겪고 있습니다…ㅠ

      어떤 해결방법으로 접근을 해봐야 할까요?? 혹시 비슷한 문제를 겪으셨던 분이 있을까요??

    • 야곰
      키 마스터
      • 글작성 : 37
      • 답글작성 : 580

      맨 마지막 문장에 친절(?)하게 어떻게 해결할 수 있는지 안내하고 있네요 🙂

      Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window

      오토레이아웃 문서의 디버깅 팁 파트도 참고해보세요. 같은 이야기가 나옵니다.

    • 종호
      참가자
      • 글작성 : 9
      • 답글작성 : 2

      감사합니다!! 참고해볼게요:D

2 답변 글타래를 보이고 있습니다
  • 답변은 로그인 후 가능합니다.

logo landscape small

사업자번호 : 743-81-02195
통신판매업 신고번호 : 제 2022-충북청주-1278 호
고객센터 : 카카오톡채널 @yagom