Reputation: 512246
I have a layout of UIButtons that looks like this:
The horizontal spacing between the buttons is 8. I would like to change this to 4. Of course, I could change them one by one, like this:
But there are a lot of buttons and I don't really feel like doing that.
I tried selecting multiple buttons and then added a horizontal space constraint of 4 but that just adds constraints. It doesn't update the old constraints. This creates conflicting constraints with the old ones.
I didn't see anything to solve this in the Editing Auto Layout Constraints documentation.
Upvotes: 5
Views: 2175
Reputation: 665
I am agree with the answer of @Leo and up voted as well :)
Just adding to it, if someone would like to make it more easier, he can use the filter option given below the constraints.
For example to find all the leading constraints one can search for " = leading" word or "trailing = " for trailing constraints or other similar search string.
You can see this from the GIF as well.
Upvotes: 2
Reputation: 13020
One of the way is to create spacer views, With each view width equal to the first one. Set your Button constraint to leading and traling to the spacer view. and if you change first width of spacer view it will change all othes view width.
Upvotes: 4
Reputation: 5428
You just have to select all button and move where you want them and then you have to just update the constraint.
Upvotes: 0
Reputation: 6462
You have to do that one by one. There isn’t any way that you select all of them an edit their values.
Upvotes: 0