我正在尝试实现UIPageController,以便我的用户可以在库中左右滑动。 UIImageView将占据整个背景,而标签将位于堆叠的顶部。这是我在界面构建器中的尝试:
UIImageView的大小检查器,因为下面的注释:
但是我在接口构建器中遇到了很多错误:
2015-09-18 22:19:33.964 ParksonUI[10525:453297] 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:0x7aec77f0 V:[_UILayoutGuide:0x7aec7330]-(449)-[UILabel:0x7aec6ca0'Over 200 Tips and Tricks']>",
"<NSLayoutConstraint:0x7aec78b0 V:[UILabel:0x7aec6ca0'Over 200 Tips and Tricks']-(20)-[_UILayoutGuide:0x7aec7440]>",
"<_UILayoutSupportConstraint:0x7aec5ee0 V:[_UILayoutGuide:0x7aec7330(64)]>",
"<_UILayoutSupportConstraint:0x7aec6690 V:|-(0)-[_UILayoutGuide:0x7aec7330] (Names: '|':UIView:0x7aec7270 )>",
"<_UILayoutSupportConstraint:0x7aec6540 V:[_UILayoutGuide:0x7aec7440(0)]>",
"<_UILayoutSupportConstraint:0x7aec7220 _UILayoutGuide:0x7aec7440.bottom == UIView:0x7aec7270.bottom>",
"<NSLayoutConstraint:0x7afea660 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7aec7270(519)]>"
)
我认为标签可能会被推到图像下方?
答案 0 :(得分:1)
首先,请确保在文档大纲中的标签之前有imageView,正如一些研究员所提到的那样。 之后,将imageView调整为主视图的所有边框,并尝试以下约束:
这些标签:
希望它有效。
答案 1 :(得分:0)
您在标签上有顶部和其他底部的约束。如果删除顶部约束,警告将消失。结果将是正确的。您可以将宽度和高度约束添加到标签而不是顶部约束。 我希望能帮到你。