自动布局的警告调试

原创
2015/12/12 23:39
阅读数 82

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

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

    "<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>",

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

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

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

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

    "<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>",

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

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


展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部