Xcode无法同时满足约束

时间:2015-08-25 15:07:38

标签: xcode image uiimageview constraints

当我运行我正在处理的应用程序时,我在控制台中收到一条消息

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)` 

Constraint error in the Xcode debugging console

我所拥有的是一张背景图片,其中包含heightwidthtrailing spaceleading spacetop spacebottom space的约束。图像的大小为321 x 571,641 x 1137和960 x 1704。

Constraints for image

1 个答案:

答案 0 :(得分:1)

我给你一个简单的建议:尝试删除所有约束并一次添加一些约束。

...但我怀疑问题可能是单个图片的heighttop spacebottom space:如果您的图片应该有一个高度不能在同时尊重所有屏幕尺寸的底部和顶部空间,没有任何优先级设置为约束。如果您在这种情况下,则需要至少删除一个约束。

我希望这会有所帮助,否则会在您的问题中添加更多信息。