Ios NSLayoutConstraint冲突。UIView封装布局高度
我在自动布局方面遇到了一些问题。尤其是在iOS8中 我已经阅读了网络,在使用Ios NSLayoutConstraint冲突。UIView封装布局高度,ios,uitableview,uiview,autolayout,nslayoutconstraint,Ios,Uitableview,Uiview,Autolayout,Nslayoutconstraint,我在自动布局方面遇到了一些问题。尤其是在iOS8中 我已经阅读了网络,在使用UITableViewCell时发现了类似的问题。 但是这里我没有使用UITableViewCell,也没有UITableView 发生这种情况时,我只需要处理一个ADBannerView和一个UIWebView 我在Xcode调试器中得到以下消息: Unable to simultaneously satisfy constraints. Probably at least one of the constra
UITableViewCell
时发现了类似的问题。
但是这里我没有使用UITableViewCell
,也没有UITableView
发生这种情况时,我只需要处理一个ADBannerView
和一个UIWebView
我在Xcode调试器中得到以下消息:
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:0x14e256f0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x14e6c870(568)]>",
"<NSLayoutConstraint:0x14d9b320 V:[ADBannerView:0x14d40c30(50)]>",
"<NSLayoutConstraint:0x14d97b00 V:|-(20)-[ADBannerView:0x14d40c30] (Names: '|':UIView:0x14e6c870 )>",
"<NSLayoutConstraint:0x14d34880 ADBannerView:0x14d40c30.bottom == UIView:0x14e6c870.bottom>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x14d34880 ADBannerView:0x14d40c30.bottom == UIView:0x14e6c870.bottom>
如果有人对正在发生的事情有什么想法,请告诉我。阅读您的限制:
"<NSLayoutConstraint:0x14d9b320 V:[ADBannerView:0x14d40c30(50)]>"
“”
ADBannerView的高度为50像素
“”
ADBannerView固定在视图顶部,边距为20
像素
您已将ADBannerView的底部固定到
尤维尤
“”
当前视图的高度为568像素
现在,这与您指定给ADBannerView的50个像素的高度相冲突,并且ADBannerView被固定在距离UIView顶部20个像素的位置
要么是ADBannerView的高度需要被打破,要么是底部的钉住,因为这两个约束都不能满足
从UIView底部取消对AdBannerView的锁定以解决此问题我明白了,感谢您的分析。当然,你写的不是我想做的。我最初想修复顶部或底部(不是两者都修复),我认为这样就足够了。我需要检查我的代码。顺便问一下,我需要自己确定高度吗?或者它是自动的,因为这是一个ADBannerView?高度应该是自动的。现在的问题是你想把AdBannerView放在哪里?在视图的顶部还是底部?
"<NSLayoutConstraint:0x14d9b320 V:[ADBannerView:0x14d40c30(50)]>"
"<NSLayoutConstraint:0x14d97b00 V:|-(20)-[ADBannerView:0x14d40c30] (Names: '|':UIView:0x14e6c870 )>"
<NSLayoutConstraint:0x14d34880 ADBannerView:0x14d40c30.bottom == UIView:0x14e6c870.bottom>
"<NSLayoutConstraint:0x14e256f0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x14e6c870(568)]>"