R.Lambert
R.Lambert

Reputation: 1170

Autolayout Constraint Error

I have a problem with autolayout contraints on my iPad project, when I rotate my device I have this error :

2013-06-03 13:16:24.969 PDFViewer[7534:907] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x1f5525e0 H:[UIScrollView:0x1f551910]-(970)-|   (Names: '|':UIView:0x1f547740 )>",
    "<NSLayoutConstraint:0x1f5525a0 H:|-(0)-[UIScrollView:0x1f551910]   (Names: '|':UIView:0x1f547740 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x1f562520 h=--- v=--- H:[UIWindow:0x1f543890(768)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x1f560af0 h=-&- v=-&- UIView:0x1f547740.width == UIWindow:0x1f543890.width>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1f5525e0 H:[UIScrollView:0x1f551910]-(970)-|   (Names: '|':UIView:0x1f547740 )>

Ok, some constraints are contentious but I don't set any constraint by myself, they are all set automatically in Interface Builder and I can't remove them. What I want is pretty simple, a scrollview, with fixed width and 100% height, and a collection view, with remaining width and 100% height.

Autolayout makes me crazy, any idea ?

Edit : Here are my constraints defined in IB

IB Constraints

Upvotes: 1

Views: 592

Answers (1)

R.Lambert
R.Lambert

Reputation: 1170

Error was caused by an automatic constraint, more precisely this one :

"<NSLayoutConstraint:0x1f5525e0 H:[UIScrollView:0x1f551910]-(970)-|   (Names: '|':UIView:0x1f547740 )>",

As it is added by IB you can't delete it, so for ignoring it I have set the priority to 1.

IB Priority

Upvotes: 1

Related Questions