Masonry 约束冲突,怎么能够快速定位到问题控件,太难找了!!

Masonry 约束冲突,怎么能够快速定位到问题控件,太难找了!!更诡异的是,我把相关的控件都注释掉了,这个约束冲突还存在,太诡异了!!!

    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<MASLayoutConstraint:0x7ff43e265c10 UILabel:0x7ff43e2673a0.top == SGStoreDetailInfoView:0x7ff43e267080.top + 14>",
    "<MASLayoutConstraint:0x7ff43e27ab50 UILabel:0x7ff43e2673a0.top == SGStoreDetailInfoView:0x7ff43e267080.top + 10>"
)
阅读 7.7k
2 个回答

这个说明已经很清楚了,有两个 top 约束,一个要 10 ,一个要 14

可以通过添加全局断点的方式,来查找出现问题的视图。

  • 通过command+7切换到项目的断点列表页面,并通过底部的加号按钮添加全部断点。

clipboard.png

  • 运行程序,当程序检测到约束问题时,会停在发生问题的代码位置。

  • 通过command+6切换到项目的Debug界面(显示栈调用视图)界面。

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题