Reputation: 401
I am attempting to implement a UIPageController so my users can swipe left and right on a gallery. The UIImageView will take up the entire background, while the label will sit ON TOP OF as in stacked. Here is my attempt in the interface builder:
Size inspector for the UIImageView because of comment below:
But I get lots of errors in the interface builder like this:
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)]>"
)
I think the label is being pushed below the image perhaps?
Upvotes: 0
Views: 825
Reputation: 86
First of all, be sure to have imageView before the label in document outline as some fellows have mentioned. After that, adjust the imageView to all borders of the main view and try the following constraints:
And these to the label:
Hope it works.
Upvotes: 1
Reputation: 233
You have constraint to top and other to bottom on label. If you remove the top constraint the warning disappear. And the result will be correct. You can add width and height constraints to label instead top constraint. I hope help you.
Upvotes: 0