IOS. How do I keep two or more objects horizontally while maintaining space between them?

I am working on a registration page. At the bottom of the page, I want to add a shortcut: "Do you have an account?" and a button titled "Login".

The result I am trying to do is that this line "Account Login" will always be centered no matter the screen size of the device. Unfortunately I was unable to find a solution with the constraints and alignment settings in the storyboard.

Can anyone help me?

+3


source to share


2 answers


You can drag and drop a new view onto your view controller and place this button and shortcut on it. Then resize the new view to fit the content. Finally, center the view horizontally.



Now, instead of horizontally centering the two controls, you only center their container, thereby preserving their position.

+2


source


If I understood the question correctly:

Select the object, click the align button in the lower right corner of the storyboard window.



And add the constraint "Horizontal Center in Container"

0


source







All Articles