Join Todd Perkins for an in-depth discussion in this video Making the Clear button clear all values, part of Programming for Non-Programmers with iOS 7.
…With the number buttons working, let's make…the clear button do what it's supposed to.…Find the tapped clear function, mine is on line 30,…and then we're going to reset all of our values here.…That means we're going to set total equal to 0, we're…going to set value string equal to an empty string,…And then we'll make the text label show 0.…Now here, we can use 0 as a string because we don't…care what the other values are because we're resetting them right here.…
So we don't need to go through the…extra effort of using NS string, string with format.…So let's test the application,…so I'll type some numbers.…Click the C button.…And the calculator clears.…Everything works as expected.…So again, to clear the calculator we simply reset all…these values back to where they were when we started.…
Author
Released
4/10/2014If 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
Duration
Views
Related Courses
-
Introduction
-
Welcome40s
-
Related courses1m 8s
-
Using the exercise files1m 19s
-
-
1. Setting Up Your Coding Environment
-
Creating an Xcode project1m 55s
-
2. Programming Building Blocks: Variables
-
Understanding variables2m 56s
-
Using primitive variables9m 10s
-
Using pointer variables4m 51s
-
Using instance variables5m 19s
-
3. Programming Building Blocks: Functions
-
4. Programming Building Blocks: Conditional Statements
-
Using conditional statements5m 21s
-
5. Building Your First Full Application
-
Conclusion
-
Next steps24s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Making the Clear button clear all values