Join Todd Perkins for an in-depth discussion in this video Solution: Add a multiplication button, part of Programming for Non-Programmers with iOS 7.
…Here's an example of the solution to this challenge.…As usual, you might have come up with another way for this solution.…And that's fine.…In ViewController.h, I'm going to copy and paste tappedEquals.…And in copying that, I'm going to change equals to multiply.…Then I'm going to copy that line of code,…go to ViewController.m and paste the code right below tappedMinus.…In here, I'm going to call the function self setMode, and…instead of 1 or negative 1, I'm going to pass in 2.…
Now we'll come back to this code in just a second, but…we need to make sure we connect tappedMultiply to the appropriate button.…So let's go to main.storyboard.…In here, I'm going to click the equals button.…Click and drag the top center box to bring it down.…So I'm shrinking that a little bit.…And then I'm going to make a copy of the minus button.…I'll drag that down.…I'll double click the minus button.…And I'll type an x.…Now I need to connect this to the appropriate function.…
So I'm going to hide the Utilities area, click on View Controller, click on…
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.