Keep your face always toward the sunshine - and shadows will fall behind you. ~Walt Whitman
In this lab, you will create an app that will draw a card on screen in response to button presses.
When the user first loads your app, its UI will look like this:
Pressing buttons will change the labels in the corners and the middle. The labels in the corner should be updated with the suit of the card (
Easy, right?
A basic Xcode project has been started for you, and can be in this repo at Cards.xcodeproj
. Notice, however, that the app is nearly empty. To paraphrase a famous Game of Thrones quote, in this lab, "You get nothing, Jon Snow!" You will have to implement this entire app from scratch (aside from the basic view controller and storyboard that has been given to you in the Xcode project). However, unlike Jon Snow, you do know something—a lot, actually—so this lab should be a breeze.
Here's what you'll need to do to complete this lab:
- Create a label in the top left and bottom right corner of the app view. You might want to bump the text size up to 28 pt. (Don't forget about the Attributes Inspector!)
- Add a label to the center of the view. Its text size should be 40 pt.
- Create four buttons with the following labels:
♣️ 4,♠️ 3,♦️ 8,♥️ 10. - Hook these buttons up to IB actions. You can hook them each up to their own IB action, or just have one single IB action that they are all attached to—your choice.
- When a button is pressed, update the labels accordingly (the ones in the corner should display the suit and the one in the center should display the value).
Good luck!