Join Todd Perkins for an in-depth discussion in this video Solution: Create a counter app, part of Programming for Non-Programmers with iOS 7.
…There are of course multiple ways to complete this challenge.…Here's what I did.…In ViewController.h, at the end of line 11, I'm going to…add some curly braces after I go to the next line.…Now here I'm going to create two variables.…One of them is going to be an integer called score.…And the other one is going to be the label that I want to display the score in.…So it's going to be IBOutlet.…
Remember, outlet is for variables and action is for functions.…The data type is going to be UILabel.…And then we'll call it label.…And again, there's an asterisk because it's not a number value.…Now we're going to declare the function that…we want to connect to the button press.…We do that outside of the curly braces, so hyphen, and then in parentheses, IBAction.…We'll call this didScore, with a capital s, and put…a semicolon at the end of this line of code.…
Now we'll go to MainStoryBoard.storyboard, and add…the label and the button to the screen.…I'm going to show the utilities view by clicking the button…at the top right, then I'm going to scroll down in the…
If you find you'd like to learn more, see iOS App Development Essential Training, Foundations of Programming: Fundamentals, or any of the other programming courses in our library.
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding functions, methods, and selectors
- Connecting a button to a function
- Using conditional statements
- Setting up the user interface
- Connecting code elements to build an app
Skill Level Beginner
1. Setting Up Your Coding Environment
Creating an Xcode project1m 55s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Functions
4. Programming Building Blocks: Conditional Statements
Using conditional statements5m 21s
5. Building Your First Full Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.