52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

autolayout constraint error #296

Open ovdm opened 5 years ago

ovdm commented 5 years ago

This issue has been reported before as #142 but was closed. I have this issue consistently, that is why I am opening a new issue.

[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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSAutoresizingMaskLayoutConstraint:0x6000033c68f0 h=--& v=--& UIView:0x7f8d527c6f30.width == 0 (active)>", "<NSLayoutConstraint:0x60000333c140 UILayoutGuide:0x600002ad3aa0'UIViewSafeAreaLayoutGuide'.trailing >= UILabel:0x7f8d5d01c790.trailing + 10 (active)>",

I traced it down to a subview of 'drawerScollView' of type UIView having an NSAutoresizingMaskLayoutConstraint of CGSize.zero.

I am using PulleyViewController in 3 places. In all of them, it is the rootviewcontroller. This eliminates the solution suggested in #142 for me. All the Container views in used by PulleyViewController in my app are build with IB.

amyleecodes commented 5 years ago

Lower your constraint priority (whichever one is throwing log).

magohamote commented 5 years ago

Lowering priority is not solving any issue, it is just hiding a problem that will therefore not be solved.

amyleecodes commented 5 years ago

Lowering priority is a solution to an impossible layout created by your constrains not being okay starting with a CGRectZero frame.

It’s a perfectly acceptable and adequate solution for layouts that used fixed spacing.

matuella commented 5 years ago

I had a similar problem as well, but this is just like @brendan09 said: set your constraints priorities to lower than the superview, but without messing up the hierarchy with other related views/constraints.