Joey
Joey

Reputation: 117

XCode/Swift 3: How to shift storyboard elements down/up without messing up existing constraints?

XCode/Swift 3

I've placed several elements (e.g. labels, text Fields) on my story board, and I've properly set all constraints.

Now I've decided that all content needs to shift down about five pixels. I can press the COMMAND + A keys to select all and then press the down arrow five times on my keyboard to shift everything. However, that messes up all of my existing constraints!

How can I shift everything down five pixels and preserve my constraints?

I'm very new to iOS programming, so thanks for your patience for what must be a very easy question for some of you!

Upvotes: 0

Views: 346

Answers (3)

Sandu
Sandu

Reputation: 490

after you shifted down all your items (like you've done)

there is a button with which you can update all constraints

enter image description here

Upvotes: 1

Hapeki
Hapeki

Reputation: 2193

If you shift elements down it will cause the constraints to update accordingly. You should update all constraints, an easy way to do it is by selection the following option:

enter image description here

Select "Update constraints" and make sure you select "Apply to all views in container".

Upvotes: 0

Gourav Joshi
Gourav Joshi

Reputation: 2419

Don't worry about it, First you have shifted all these downs now on storyboard left side there is a Document Outline Bar, on that your storyboard has a yellow arrow, click that and you will see all the shifted objects are presents with their properties. Click them one by one and and select

Update Constraints

This will set your constraints as you updated.

Upvotes: 0

Related Questions