Join Todd Perkins for an in-depth discussion in this video Solution: Build an on/off button app, part of Programming for Non-Programmers: iOS 7.
…Here is one example of a solution to this challenge.…I'm working in ViewController.h to start.…Your ViewController.h at the end of line 11, I'm going…to go to the next line, add some curly braces.…Inside of the curly braces, I'm going to create a Boolean…variable, so BOOL, and then we'll call this isOn.…That's going to hold whether or not the button is on.…
On the next line, I'm going to create a text label…variable that will connect to a UI label in the storyboard.…So that's going to be IBOutlet, UILabel, and then we'll just call it label.…Remember, an asterisk because it's a pointer value.…Below the closed curly brace, I'm going to go down a…few lines, and I'm going to create an IB action function.…We'll call this, clickedButton, capital B.…I'll add a semicolon to the end, and then…we'll connect these to our code and main storyboard.storyboard.…
I'll show the view on the right, and then I'll scroll down…in the Object Library, drag a label to the middle of the screen.…And then I'll drag the button to the middle of the screen.…
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.