Assertion failure in -[UITableView layoutSublayersOfLayer:]

三世轮回 提交于 2019-11-28 23:39:34

As a general solution to this problem, or at least a way of finding the cause of it:

  • Turn on exception breakpoints
  • Subclass UITableView and override layoutSublayersOfLayer:, just calling super
  • Run your app - you will stop in your new method
  • In the debugger, type po [self _autolayoutTrace]

This will show you a printout of every view in the window, with the views where auto layout has not been able to come up with a solution highlighted by asterisks or AMBIGUOUS LAYOUT. These are the views you need to investigate the constraints for.

Vladimír Slavík

When adding a subview to UITableView there are some specific requirements for the subview. Consider adding the subview to another view(superview) in your controller instead of UITableView.

"Auto Layout still required after executing -layoutSubviews" with UITableViewCell subclass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!