自动布局的警告调试

<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 的高度去掉

加一个设置高度和预告高度便可 顺便把最后一个控件的向下的约束也去掉 就不会有警告了

相关文章
相关标签/搜索