Domanda

I have several buttons and i want the lower one to placed in center Y plus 10-15 pixels. I am trying to do this with the auto layout constraints, but i can't figure out what should be the correct constraint.

È stato utile?

Soluzione

Add the Vertical Center in Container constraint (Alignment constraint button on the interface builder) to the buttons and change the constant to -10 to -15 as appropriate. You will probably need a x constraint, height constraint, and a width constraint as well.

Altri suggerimenti

I don't think it's possible to place an item "N points above the center." Instead, you can create a plain UIView with a transparent background and center that in your window. Give it a height of 10 points or so. Then you can use auto layout to place your buttons ~5-10 points above that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top