What is this limitation related to?

I read all the SO questions like this and I'm so lost. I get the following error:

2015-09-14 22:59:40.455 guess-who[60143:9602686] 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:0x7c0f8e30 UIImageView:0x7b6efb60.top == _UILayoutGuide:0x7c0f67a0.top>", "<_UILayoutSupportConstraint:0x7c0f8ae0 V:[_UILayoutGuide:0x7c0f67a0(0)]>", "<_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom>", "<NSAutoresizingMaskLayoutConstraint:0x7b6f6130 h=--& v=--& UIImageView:0x7b6efb60.midY == + 204>", "<NSAutoresizingMaskLayoutConstraint:0x7b6f6160 h=--& v=--& V:[UIImageView:0x7b6efb60(220)]>", "<NSLayoutConstraint:0x7b6f6dc0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7c0f65e0(518)]>", "<NSAutoresizingMaskLayoutConstraint:0x7b6f6e20 h=-&- v=-&- 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x7c0f65e0] (Names: '|':UIView:0x7c0effc0 )>" ) Will attempt to recover by breaking constraint <_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom> 

I got this for a bunch of other restrictions that I have successfully resolved, but this one is haunting me. I do not know what UILayoutSupportConstraint ; The documentation is not very thorough. I looked at the view debugger and the UIView:0x7c0f65e0 seems to refer to my main view (although for some reason is it a child of an empty view?). I cannot find anything with 0x7c0f67a0, although this seems to apply to LayoutGuide, saying that their bottoms should be equal. I'm not sure what other tools are available for me to figure this out.

EDIT:

Using View Debugger, I narrowed it down to one of these two restrictions, none of which the source knows:

enter image description here

I can not find where any of them will be installed. I know that every first sentence is to set translatesAutoresizingMaskIntoConstraints to false, but this destroys my entire layout, and I don't know how to fix it.

+5
source share
4 answers

You can also consider adding availability identifiers and restriction identifiers to your views to make your AL logs more legible:

constraintVariableName.identifier = "constraintVariableName";

In InterfaceBuilder, use the identifier property in the inspector.

self.loginButton.accessibilityLabel = NSLocalizedString("LoginButtonAccessibilityLabel", @"");

These identifiers will go to the logs, for example, you published above, replacing identifiers such as UIView, UIImageView and UIConstraint.

+8
source

You seem to have set limits on the presentation of the image relative to Superview. Therefore, to satisfy you the UILayoutGuide.bottom restriction, your restrictions do not work. Since you have added additional or unnecessary restrictions that were not necessary.

Interrupts that become broken :

  • UILayoutGuide.top = UIView.top
  • UILayoutGuide.height = 0
  • UILayoutGuide.bottom = UIView.bottom
  • UIImageView Height Limit
  • UIImageView Y Position
  • UIView Height Limit
  • You gave the vertical interval of the UIView at the top - '0', but there is no lower / upper level restriction.

Try changing the priority of height restrictions from 1000 to 750 for UIImageview with height (220), UIView with height (518).

You also need to check the lower limit for "<NSAutoresizingMaskLayoutConstraint:0x7b6f6e20 h=-&- v=-&- 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x7c0f65e0] (Names: '|':UIView:0x7c0effc0 )>"

If possible, please attach a demo on git for a better idea.

Hope this helps.

+3
source

Disabling Translations AutoresizingMaskIntoConstraints destroys your layout because some of your stacked elements do not have an explicit height / width (PlayAgain, cat, frame) and are based on image content.

Your sample project does not start out of the box, so I cannot check the runtime layout. However, I would start by specifying the height of these elements so that there are less auto restrictions. It also looks like you are changing a lot of constraints at runtime, so you need to be careful about changing constraints that will conflict with each other. Make sure the layout is happy before you start messing around with constant consistency!

+2
source

Use the following line. It can help you.

 [view setTranslatesAutoresizingMaskIntoConstraints:NO]; 
-4
source

All Articles