Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pin Horizontal Spacing Between Two UIImage Views in Xcode 7

Tags:

xcode

ios

xcode7

I am a beginner using Xcode 7 beta, working off a tutorial that uses Xcode 6. In the tutorial, the instructor selects Editor, Pin, and Horizontal Spacing to pin the space between two images so that it stays the same when switching to landscape. In Xcode 7, the Editor menu doesn't include a Pin menu. Does anyone know how to pin horizontal spacing between two images in the new Xcode 7?

like image 246
Wyatt Avatar asked Jun 12 '15 21:06

Wyatt


3 Answers

This is close to what you need

You can choose View (current distance = 0) from the drop down menu

Constrain image


GIF

like image 86
Inder Kumar Rathore Avatar answered Nov 15 '22 21:11

Inder Kumar Rathore


Use the pin button at the bottom right corner of the storyboard view. It looks like a Tie-fighter icon.

You will also notice that Pinning two elements to each other for horizontal and vertical spacing is not there. Instead select the left item and add a right constraint. Then select the right one and add a left constraint. You will see the horizontal spacing indicator appearing between the two. YMMV.

EDIT

If you are going thru the same tutorial (RW) as I am going thru, fear not! The control-drag between elements still works the same and brings the options XCode 6 shows in a similar way (ex: ctrl-drag from left to right way brings a popup menu with horizontal spacing.) I hope this helps.

like image 23
John Difool Avatar answered Nov 15 '22 21:11

John Difool


Just to kind of clear this (good) answer up - select the left image, then the "pin" icon (tie fighter looking thing), click the right constraint icon at the top that looks like this:

|--|

...leave the value of it where it is. Then click the "add constraints" button. Do the same for the right image. Then run the app and verify that it works.

like image 1
saint_berzerker Avatar answered Nov 15 '22 20:11

saint_berzerker