自動佈局的警告調試

<SnapKit.LayoutConstraint:0x7ff912a1ce10@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#91web

Weibo01.NWHomeCellTop:0x7ff912a159a0.top == UITableViewCellContentView:0x7ff912a147e0.top>",swift

    "<SnapKit.LayoutConstraint:0x7ff912a213f0@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#91佈局

Weibo01.NWHomeCellTop:0x7ff912a159a0.height == 59.0>",spa

    "<SnapKit.LayoutConstraint:0x7ff912a21af0@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#102it

UILabel:0x7ff9104a98d0.top == Weibo01.NWHomeCellTop:0x7ff912a159a0.bottom + 12.0>",webkit

    "<SnapKit.LayoutConstraint:0x7ff912a22340@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#111top

Weibo01.NWHomePictureView:0x7ff912051000.top == UILabel:0x7ff9104a98d0.bottom + 12.0>",sse

    "<SnapKit.LayoutConstraint:0x7ff912a22d00@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#111錯誤

Weibo01.NWHomePictureView:0x7ff912051000.height == 270.0>",ab

    "<SnapKit.LayoutConstraint:0x7ff912a23630@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#124

Weibo01.NWHomeCellBottom:0x7ff9104ab450.top == Weibo01.NWHomePictureView:0x7ff912051000.bottom + 12.0>",

    "<SnapKit.LayoutConstraint:0x7ff912a252d0@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#124

Weibo01.NWHomeCellBottom:0x7ff9104ab450.height == 44.0>",

    "<SnapKit.LayoutConstraint:0x7ff9128b50c0@/Users/VENN/Desktop/\U5fae\U535a/VennBlog/\U5fae\U535a01/\U5fae\U535a01/Classes/View/Home/Cell/NWHomeCell.swift#124

Weibo01.NWHomeCellBottom:0x7ff9104ab450.bottom == UITableViewCellContentView:0x7ff912a147e0.bottom>",

你們看到這一坨東西就是自動佈局系統的計算失敗 發出警告 咱們只看swift#後的內容發現都是跟垂直方向有關係的,這就說明咱們在垂直方向的佈局出了問題 ,因此只要從上往下就知道那個方向的錯誤

通常狀況下要是約束出了警告大部分狀況就是約束加多了 上面這個狀況就是 破法 把自動設置cell 的高度去掉

加一個設置高度和預告高度便可 順便把最後一個控件的向下的約束也去掉 就不會有警告了

相關文章
相關標籤/搜索