The clear button is supposed to reset the calculator to its default state. This video shows how to go through that process to make the button work.
- [Narrator] Our next step is to clear out the calculator…when you press the Clear button.…Now, what that's going to do essentially,…is completely reset all of our variables…and reset the label to display "zero."…So if we scroll to the top, and we look at all the…default values for our variables, this is what we want here.…We want the label string to be zero,…we want the label to have the text "zero" inside of it.…We want the Mode to be not set, we want savedNum…equal to zero, we want lastButtonWasMode equal to false.…
Now a shortcut for doing this would be just to copy this,…select it all, press the Command C on my keyboard…to copy it, and scroll…down and do this inside of didPressClear.…So I put my cursor at the end of that close curly brace,…get a few lines in there with a return,…and then paste the code.…Now of course we don't want to redefine these values,…we just want to reset them.…So I need to erase that var call at the beginning…of every line, and then I need to erase the data types…that I have at the beginning of every line.…
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding methods
- Connecting a button to a method
- Using conditional statements
- Setting up the user interface (UI)
- Building a complete iOS app
Skill Level Beginner
1. Set Up Your Coding Environment
Create an Xcode project4m 19s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Methods
4. Programming Building Blocks: Conditional Statements
5. Plan and Prepare the App
6. Build a Full Application
Next steps3m 11s
- 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.