0

I have a tableView with some static cells. It's set to automatically calculate the row height. The bottom most button is in a cell with a height constraint along with top, bottom, leading, and trailing. All constraints are done in the interface builder with no warnings or errors showing for the scene.

Button Placement

Yet I'm getting this warning when I run the app and display the scene:

2018-01-16 08:00:40.149994-0500 Reference App[9176:1864272] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    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. 
(
    "<NSLayoutConstraint:0x7fd01dd16530 UIButton:0x7fd01dd171a0'Reset Data'.height == 44   (active)>",
    "<NSLayoutConstraint:0x7fd01dd31860 V:|-(0)-[UIButton:0x7fd01dd171a0'Reset Data']   (active, names: '|':UITableViewCellContentView:0x7fd01dd314c0 )>",
    "<NSLayoutConstraint:0x7fd01dd31bb0 V:[UIButton:0x7fd01dd171a0'Reset Data']-(0)-|   (active, names: '|':UITableViewCellContentView:0x7fd01dd314c0 )>",
    "<NSLayoutConstraint:0x7fd01d8516c0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fd01dd314c0.height == 44   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fd01dd16530 UIButton:0x7fd01dd171a0'Reset Data'.height == 44   (active)>

I don't understand why I'm getting the error. As suggested at this link What is NSLayoutConstraint "UIView-Encapsulated-Layout-Height" and how should I go about forcing it to recalculate cleanly?, I tried lowering the priority of the height constraint to 999 and it didn't fix the issue. I also gave an estimated height of 44 and it reduced the output to simply the warning about a zero height.

What am I doing wrong?

Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
  • 1
    Possible duplicate of [what is NSLayoutConstraint "UIView-Encapsulated-Layout-Height" and how should I go about forcing it to recalculate cleanly](https://stackoverflow.com/questions/25059443/what-is-nslayoutconstraint-uiview-encapsulated-layout-height-and-how-should-i) – Tamás Sengel Jan 16 '18 at 13:10
  • In short: set the priority of the height constraint to 999. – Tamás Sengel Jan 16 '18 at 13:10
  • @the4kman, tried that and it didn't work. – Aaron Bratcher Jan 16 '18 at 13:20
  • Okay. The zero height warning must have been from a different cell. I make sure I had top to bottom constraints on the other cells and found one was missing the appropriate constraints. Fixing this made the zero height error go away. – Aaron Bratcher Jan 16 '18 at 13:25

0 Answers0