Reputation: 280
I'm trying to have to views overlap as shown in the picture below, but I couldn't figure out how would I go about doing it with auto layout.
I tried doing the bottom view programmatically, and it worked fine except for the button which I had laid out using interface builder.
If it's possible to have views overlap what are the constraints needed, and is there a way to let the button show on top of the view in the bottom without doing programmatically?
Upvotes: 4
Views: 2869
Reputation: 2149
You can do something like this.
make the second view uplift with minus value:
Here is the output. SecondView(green) has been uplifted to -50
Upvotes: 1
Reputation: 646
In the interface builder, using a constraint, hook the top of the bottom view to the bottom of the top view, and then edit the constant in the Size Inspector to move it like you want.
It should look something like this:
Upvotes: 0
Reputation: 2714
You can do overlapping views using InterfaceBuilder. First create the top view i.e the one with image, give its constraints like top ,trailing,leading and bottom space. Then create the overlapping view. The constraints for the overlapping view can be its trailing space, leading space,bottom space and height. Then add those buttons inside that view.
Upvotes: 0