Card War: Creating the User Interface
Master iOS Interface Design Through Card Game Development
Core UI Components We'll Build
Interactive Card Deck
A button styled with card back image that users tap to draw cards. Includes aspect ratio constraints and proper sizing.
Score Tracking System
Dynamic labels that display and update player scores throughout the game. Positioned with precise constraints.
Game Controls
Restart button and deck label providing complete game control interface with landscape orientation support.
This tutorial builds a simplified War card game focusing entirely on UI creation and constraint management. No game logic is implemented in this phase.
Xcode Project Setup Process
Create New Project
Use Cmd-Shift-N to create new App project with Storyboard interface and Swift language
Configure Project Settings
Set product name to Card War, disable Core Data and Tests, choose save location
Set Orientation
Under Deployment Info, uncheck Portrait and Landscape Right, keeping only Landscape Left
Select all images with Cmd-A and drag them directly to the Assets folder in Xcode. This includes individual card images, card back, and background assets.
UI Foundation Setup
Configure Main Storyboard
Open Main storyboard and switch to Landscape orientation for proper layout preview
Rename Root View
Select the main View in Document Outline and rename to 'superView' for better organization
Set Temporary Background
Choose Clover color from Crayons palette as placeholder before adding background image
Card Button Creation Checklist
Initial positioning doesn't need to be exact
Clear the Title field in Attributes inspector
This replaces text with the card back image
Control-drag from Button to superView
Second Control-drag to superView
Third Control-drag for proportional sizing
Control-drag Button to itself
The card image is 329x488 pixels. Set aspect ratio multiplier to 329:488, height multiplier to 0.36, X-axis to 0.24, and Y-axis to 1.1 for proper positioning.
Label Creation and Styling
Create Deck Label
Add label above card button, set white color, Palatino Bold font, center alignment, and black shadow
Duplicate for Score Labels
Option-drag to create copies for Player 1 Score label and score value display
Customize Player 1 Labels
Set first copy to 'Player 1 Score:' with left alignment and 16pt font, second copy to '0' with 18pt font
Create Player 2 Labels
Command-click both Player 1 labels, then Option-drag to create Player 2 score tracking labels
Label Constraint Multipliers
| Feature | Label | X-Axis | Y-Axis |
|---|---|---|---|
| Deck Label | Center to Button | 1.06 spacing | |
| Player 1 Score | 0.5 | 0.12 | |
| Player 2 Score | Leading to P1 | 1.88 | |
| Score Values | 1.04 spacing | Center to labels |
Rename buttons to 'Restart Button' and 'Deck Button' in Document Outline. Order elements top-to-bottom, left-to-right for easier management.
Restart Button Constraint Values
Add Image View to replace the temporary green background. This completes the visual foundation for the Card War game interface.
Key Takeaways

.
button and set the following typography specifications:
.

.
. Click the up arrow once to change the font size to 18.
