Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-自动布局';无法同时满足约束';_Ios_Autolayout_Xcode6_Constraints - Fatal编程技术网

iOS-自动布局';无法同时满足约束';

iOS-自动布局';无法同时满足约束';,ios,autolayout,xcode6,constraints,Ios,Autolayout,Xcode6,Constraints,我正在尝试修复运行应用程序时不断出现的这些错误 我有一个使用原型单元的UITableView,尽管Xcode脚本中没有列出约束问题的错误,但我还是不断地得到这些错误。 不知道如何阅读这些错误,所以希望有人能帮助我 应拉伸整个单元格宽度/高度的背景UIImageView: ( "<NSLayoutConstraint:0x174086c20 UIImageView:0x1741e7100.width == 2.5*UIImageView:0x1741e7100.height>"

我正在尝试修复运行应用程序时不断出现的这些错误

我有一个使用原型单元的UITableView,尽管Xcode脚本中没有列出约束问题的错误,但我还是不断地得到这些错误。 不知道如何阅读这些错误,所以希望有人能帮助我

应拉伸整个单元格宽度/高度的背景UIImageView:

(
    "<NSLayoutConstraint:0x174086c20 UIImageView:0x1741e7100.width == 2.5*UIImageView:0x1741e7100.height>",
    "<NSLayoutConstraint:0x174087530 H:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x1740875d0 V:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087620 H:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087670 V:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x170088890 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x174181e10(375)]>",
    "<NSLayoutConstraint:0x1700888e0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x174181e10(160)]>"
)
(
    "<NSLayoutConstraint:0x174086e00 Bobblehead_TV.BobbleheadImageView:0x100715ff0.width == 0.5*Bobblehead_TV.BobbleheadImageView:0x100715ff0.height>",
    "<NSLayoutConstraint:0x1740873a0 Bobblehead_TV.BobbleheadImageView:0x100715ff0.width == Bobblehead_TV.BobbleheadImageView:0x1007180e0.width>",
    "<NSLayoutConstraint:0x1740873f0 H:|-(0)-[Bobblehead_TV.BobbleheadImageView:0x100715ff0]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087490 Bobblehead_TV.BobbleheadImageView:0x100715ff0.top == UIImageView:0x1741e7100.top>",
    "<NSLayoutConstraint:0x1740874e0 Bobblehead_TV.BobbleheadImageView:0x100715ff0.bottom == UIImageView:0x1741e7100.bottom>",
    "<NSLayoutConstraint:0x1740875d0 V:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087670 V:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087710 Bobblehead_TV.BobbleheadImageView:0x1007207d0.width == Bobblehead_TV.BobbleheadImageView:0x1007180e0.width>",
    "<NSLayoutConstraint:0x174087800 H:[Bobblehead_TV.BobbleheadImageView:0x100715ff0]-(>=0)-[Bobblehead_TV.BobbleheadImageView:0x1007207d0]>",
    "<NSLayoutConstraint:0x174087850 UITableViewCellContentView:0x174181e10.centerX == Bobblehead_TV.BobbleheadImageView:0x1007180e0.centerX>",
    "<NSLayoutConstraint:0x1740878a0 H:[Bobblehead_TV.BobbleheadImageView:0x1007207d0]-(>=0)-[Bobblehead_TV.BobbleheadImageView:0x1007180e0]>",
    "<NSLayoutConstraint:0x170088890 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x174181e10(375)]>",
    "<NSLayoutConstraint:0x1700888e0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x174181e10(160)]>"
)
(
"",
"",
"",
"",
"",
"",
""
)
UIImageView(5),假设宽度/高度匹配,以单元格中的第三个UIImageView为中心,彼此之间的距离相等(旋转到横向时,这些项目保持居中,第一个/最后一个单元格的左/右距离刚好增加):

(
    "<NSLayoutConstraint:0x174086c20 UIImageView:0x1741e7100.width == 2.5*UIImageView:0x1741e7100.height>",
    "<NSLayoutConstraint:0x174087530 H:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x1740875d0 V:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087620 H:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087670 V:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x170088890 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x174181e10(375)]>",
    "<NSLayoutConstraint:0x1700888e0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x174181e10(160)]>"
)
(
    "<NSLayoutConstraint:0x174086e00 Bobblehead_TV.BobbleheadImageView:0x100715ff0.width == 0.5*Bobblehead_TV.BobbleheadImageView:0x100715ff0.height>",
    "<NSLayoutConstraint:0x1740873a0 Bobblehead_TV.BobbleheadImageView:0x100715ff0.width == Bobblehead_TV.BobbleheadImageView:0x1007180e0.width>",
    "<NSLayoutConstraint:0x1740873f0 H:|-(0)-[Bobblehead_TV.BobbleheadImageView:0x100715ff0]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087490 Bobblehead_TV.BobbleheadImageView:0x100715ff0.top == UIImageView:0x1741e7100.top>",
    "<NSLayoutConstraint:0x1740874e0 Bobblehead_TV.BobbleheadImageView:0x100715ff0.bottom == UIImageView:0x1741e7100.bottom>",
    "<NSLayoutConstraint:0x1740875d0 V:[UIImageView:0x1741e7100]-(0)-|   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087670 V:|-(0)-[UIImageView:0x1741e7100]   (Names: '|':UITableViewCellContentView:0x174181e10 )>",
    "<NSLayoutConstraint:0x174087710 Bobblehead_TV.BobbleheadImageView:0x1007207d0.width == Bobblehead_TV.BobbleheadImageView:0x1007180e0.width>",
    "<NSLayoutConstraint:0x174087800 H:[Bobblehead_TV.BobbleheadImageView:0x100715ff0]-(>=0)-[Bobblehead_TV.BobbleheadImageView:0x1007207d0]>",
    "<NSLayoutConstraint:0x174087850 UITableViewCellContentView:0x174181e10.centerX == Bobblehead_TV.BobbleheadImageView:0x1007180e0.centerX>",
    "<NSLayoutConstraint:0x1740878a0 H:[Bobblehead_TV.BobbleheadImageView:0x1007207d0]-(>=0)-[Bobblehead_TV.BobbleheadImageView:0x1007180e0]>",
    "<NSLayoutConstraint:0x170088890 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x174181e10(375)]>",
    "<NSLayoutConstraint:0x1700888e0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x174181e10(160)]>"
)
(
"",
"",
"",
"",
"",
"",
"",
"",
“=0)-[Bobblehead_TV.BobbleheadImageView:0x1007207d0]>”,
"",
“=0)-[Bobblehead_TV.BobbleheadImageView:0x1007180e0]>”,
"",
""
)
应拉伸整个单元格宽度/高度的背景UIImageView:

您希望图像视图拉伸整个单元格,但有一条规则将纵横比锁定为1:2.5。您需要删除此规则

UIImageView(5),假设宽度/高度匹配,以单元格中的第三个UIImageView为中心,彼此之间的距离相等(当旋转到横向时,这些项目保持居中,第一个/最后一个单元格的左/右距离刚好增加):

这个问题要复杂得多,但我会冒险猜测,这是同一个纵横比问题。这次是
Bobblehead_TV。BobbleheadImageView:0x100715ff0.width==0.5*Bobblehead_TV。BobbleheadImageView:0x100715ff0.height
将纵横比锁定在1:0.5。

我的朋友

原因可能是 1:您没有足够的约束来满足布局。或 2:您添加了超过所需的约束

因此,布局不明确。它是混乱的,所以警告

我的意见是重新检查你所有的限制。并提供最小的约束,但要具体。
谢谢

您是否正在调整UITableViewCellContentView或BobbleHadimageView的大小或设置其框架?我还建议删除故事板中的所有约束,并逐个重新添加。除了根据iPhone或iPad设置“EstimatedHeightForRowatineXpath”和“HeightForRowatineXpath”中的高度外,不要以编程方式调整任何内容的大小。这些高度与原型高度不同,只是因为情节提要在默认情况下使控制器为600x600。我希望避免删除所有约束条件,并尽可能重新添加,因为有很多约束条件,而且在运行应用程序时,我花了很长时间才让它真正完美地工作。这与设置高度有关。您能否删除单元格顶部和底部的约束,并查看它是否至少消除了错误?