-
UIView-Encapsulated-Layout-Width 오류Swift 2022. 3. 24. 11:33
분명히 맞게 UILayout을 작성한것 같은데 아래와 같은 오류가 뜰때
UIView-Encapsulated-Layout-Width Width가 0 이라는것과 충돌된다는 오류가 뜰때
// 예시 "<NSLayoutConstraint:0x600002cdab70 'UIView-Encapsulated-Layout-Width' FooterView:0x7fc01601b410.width == 0 (active)>" ) Will attempt to recover by breaking constraint
UIView-Encapsulated-Layout-Width(or Height)
가 뭔지 궁금할텐데, 이거는 tableview 나 collectionView에서 headerview 나 footerview로 지정했을때 생기고
오류났을때를 내용들을 보니까 viewdidload에서 실행했는지, 레이아웃의 구성 시점에 대한 오류라고 하는것 같았는데,,, 나에겐 해당되지 않는 내용이었다. (맞는 시점에 호출하고 있었음)
This happens for me when I customise a UIView with some subViews. And the view was used as table footerView or headerView this error happens.
가장 도움이 되었던건 아래를 보고 Priority 조정해주는걸로 결론 남.
UIView-Encapsulated-Layout-Width and Height Constraints error
Some times when you using auto layout you may come across the error like this:
medium.com
나같은 경우는 다음과 같이 수정했음 (width 오류였고, 이런식으로 활용함)
label.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(16).priority(.high) }
728x90'Swift' 카테고리의 다른 글
Associated type? (0) 2022.01.04 View의 life cycle (layoutsubviews에 대해) (0) 2021.12.31 Xcode Cloud란 (0) 2021.12.28 Swift AsyncSequence (비동기 시퀀스에 대한 지원) (0) 2021.12.22 Feature flags in Swift (0) 2021.12.22