Sajjad Aims Sajjad Aims - 1 year ago 106
Swift Question

Bound the button to top right corner of the view iOS swift

I have a view in which i have multiple labels enter image description hereand a button i want the button to be bound to the top right corner

when i apply the add Missing constraints layout the button gets separate position for different devices Please help me to resolve this

Answer Source

NEVER use add missing constraints. This is a bad way of constructing your layout.

The easiest way to get your desired look is to decide on the size you want your button to be (eg. 30x30)

Then you add the following constraints to your button:

This sets the button's width & Height:

enter image description here

Then pin it to the right top corner:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download