Xcode Swift Code: Creating the Interface and constraints for the Card Game

Creating the Interface and constraints for the Card Game

Today I learned how to use auto layout in Xcode 6 in order to create the user interface for the card game.
Auto layout is very important because it allows you to resize the buttons and UI images to scale and resolution using aspect ratio. This is particular important because if you want the application to run on several iOS devices, then you need to taken into account the resolution as the screen size differs on each of the devices.

Below is an example of what the Auto Layout looks like.

Screen Shot 2014-10-10 at 19.05.02

Figure 1: UI Images and the Interface Constraints


Once the Auto Layout is properly set up with its constraints, the image can be applied to the UI Images. To make sure that it is set up properly, I run the game to see what my user interface looks like. The result is shown below in Figure 2.

Screen Shot 2014-10-10 at 19.05.22

Figure 2: End result of the set up

The step is to implement the card images to my UI Image set up.