Andrew Phillips
Andrew Phillips

Reputation: 987

Constrained Based Layout Issue

For the life of me, i can't figure this one out. I am using the auto layout in a story board and everything works fine, even when i ignore this error. The layout shows no warnings or errors, but i still get this error. I've studied it and i guess i can't read it well enough to tell me what is conflicting....

Any help here would be appreciated..

(
    "<NSLayoutConstraint:0xac58860 V:[UIButton:0xac579c0(22)]>",
    "<NSLayoutConstraint:0x9df1030 V:[UIView:0xfc9eb70(1)]>",
    "<NSLayoutConstraint:0x9df17b0 V:[UIView:0xfc9e470(22)]>",
    "<NSLayoutConstraint:0x9df0810 V:|-(0)-[UIButton:0xac579c0]   (Names: '|':UIView:0xfc9e470 )>",
    "<NSLayoutConstraint:0x9df05e0 V:[UIButton:0xac579c0]-(0)-[UIView:0xfc9eb70]>",
    "<NSLayoutConstraint:0x9df00c0 V:[UIView:0xfc9eb70]-(0)-[UITableView:0xdb1aa00]>",
    "<NSLayoutConstraint:0x9defc60 V:[UITableView:0xdb1aa00]-(0)-|   (Names: '|':UIView:0xfc9e470 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0xac58860 V:[UIButton:0xac579c0(22)]>

Upvotes: 0

Views: 28

Answers (1)

Fogmeister
Fogmeister

Reputation: 77641

Have you been through the errors and built up what it's doing?

So...

  1. UIButton 9c0 has height 22
  2. UIView b70 has height 1
  3. UIView 470 has height 22
  4. 470 is the superview of 9c0
  5. top of 470 to top of 9c0 = 0
  6. bottom of 9c0 to top of b70 = 0
  7. bottom of b70 to top of tableview a00 = 0
  8. bottom of a00 to bottom of 470 = 0

It's fairly clear what's going on here.

You have a UIView 0xf9e470 which is the super view of a UIButton, another UIView and a UITableView.

The super view has a fixed height of 22. But you have a button of height 22 and a view of height 1 (thats 23 in total) which has to fit inside it. That won't work.

You probably need to remove (or update) the height constraint of 0xf9e470.

Upvotes: 1

Related Questions