0
我试图在uiview的下边距和滚动视图的下边距之间设置编程约束。然而,xcode给了我一些错误,文本看起来最好不合适,有时它并不出现Swift编程约束下边距不起作用
所以基本上我有一个尺寸为400的uview,并将父视图作为滚动视图。 我想在滚动视图底部和uiview底部之间添加300的距离。我需要以编程方式执行此操作,因为无法确定屏幕上给定时间将显示多少视图,因此我需要以编程方式更改它们之间的约束。
我的代码是
view.addConstraint(NSLayoutConstraint(
item:container1,
attribute:NSLayoutAttribute.Bottom,
relatedBy:NSLayoutRelation.Equal,
toItem:scrollFrame,
attribute:NSLayoutAttribute.Bottom,
multiplier:0,
constant:400)
)
但它不工作......显然,在模拟器,UIView的从顶部,或者说定位在400,因为它的动作下来的时候我增加恒压(试600)
的Xcode打印以下错误:
2015-03-25 12:38:13.342 GraficTest[6612:707546] 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:0x7be906b0 V:|-(48)-[UIView:0x7be8e780] (Names: '|':UIScrollView:0x7be90340)>",
"<NSLayoutConstraint:0x7bfd80e0 V:[UIView:0x7be8e780(257)]>",
"<NSLayoutConstraint:0x7bf6a940 UIView:0x7be8e780.bottom == + 600>"
)
你能帮帮我吗?
非常感谢!
非常感谢,这样做! – 2015-03-25 13:02:52