Adding Buttons and Labels
Now that you’ve prepared pictures, it’s time to display them as UI elements that players can see and select. You can add a Game Status label and Reset button, too, though these elements aren’t linked to images. Start by navigating to Main.storyboard in the Xcode project inspector. You should see the blank canvas where you’ll place your grid. Locate the search bar in the bottom-right corner of the editor and type in UI Image View. Xcode returns a result, which you can drag and drop onto the main workspace.
Stretch the UIImageView until it fills the screen. After you’ve resized the element, click it and look for the Attributes inspector in the upper-right corner. Be sure to uncheck the User Interaction Enabled option under ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access