Assertion failure in -[UITableView layoutSublayersOfLayer:]

后端 未结 2 1409
南方客
南方客 2020-12-15 10:25

I want to use an UISearchDisplayController on UIViewController, that includes an UITableView.
I use Autolayout. When i try to put

2条回答
  •  半阙折子戏
    2020-12-15 10:59

    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.

提交回复
热议问题