简体   繁体   中英

Xcode 6 constraints on different sizes

I'm doing an iPhone app using Xcode 6 My problem here is, I add a constraint to an image, and all is fine, and than I try to add another constraint on a smaller screen and I get the error on the bottom of this message. Is there any way of adding different constraints according to the size we are at? That is what it feels like on Xcode on the wAny hAny area, but for some reason it just doesn't work.

2014-10-06 17:41:45.059 testapp[2623:26567] 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) ( "", "", "", "" )

Will attempt to recover by breaking constraint

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.

When a constraint receives a negative value or the value that contradicts with other values, it spits an error. For instance:

  • You have an image, that has height 500 and the constraint attached to it's bottom
  • You modify this constraint such a way that the image gets smaller and smaller (constant value)
  • Eventually image will have negative value, which is impossible. And the rest of the constraints will also "suffer"

Make sure that the height of the parent view is greater than the height of the image. Hopefully the example above will make you better understand the issue in general.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM