Lecture #4: Views

Please note, this blog entry is from a previous course. You might want to check out the current one.

The forth lecture is called “4. Views (October 6, 2011)” and can be found via iTunes. Its slides are available directly at Stanford.

It starts with an half-an-hour demo/walkthrough preparing the calculator for the second assignment using functionality learned in the previous lectures. When you have finished this part you should have something similar to like our example on github. Alternatively a sample code can be downloaded from Stanford but it does not include all the functionality from the previous assignments.
Continue reading “Lecture #4: Views”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Lecture #3: Objective-C

Please note, this blog entry is from a previous course. You might want to check out the current one.

The third lecture is called “3. Objective-C (October 4, 2011)” and can be found via iTunes. Its slides are available directly at Stanford.

It starts with a review what we have learned doing the walkthrough of the last lecture and explains in more detail
Continue reading “Lecture #3: Objective-C”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #1 Extra Task #3

Please note, this blog entry is from a previous course. You might want to check out the current one.

Add a +/- operation which changes the sign of the number in the display. Be careful with this one. If the user is in the middle of entering a number, you probably want to change the sign of that number and let them continue entering it, not force an enterPressed like other operations do. But if they are not in the middle of entering a number, then it would work just like any other single-operand operation (e.g. sqrt).

Add the “+/-” button in the storyboard by copying an operation button.

If the user is in the middle of entering a number, we just change the display and the history in operationPressed inside CalculatorViewController.m:
Continue reading “Assignment #1 Extra Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #1 Extra Task #2

Please note, this blog entry is from a previous course. You might want to check out the current one.

When the user hits an operation button, put an = on the end of the text label that is showing what was sent to the brain (required task #4). Thus the user will be able to tell whether the number in the Calculator’s display is the result of a calculation or a number that the user has just entered.

Basically we add an equal sign in operationPressed:

    self.history.text = [self.history.text stringByAppendingFormat:@" %@ =", sender.currentTitle];

Continue reading “Assignment #1 Extra Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #1 Extra Task #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

Implement a “backspace” button for the user to press if they hit the wrong digit button. This is not intended to be “undo,” so if they hit the wrong operation button, they are out of luck! It’s up to you to decided how to handle the case where they backspace away the entire number they are in the middle of entering, but having the display go completely blank is probably not very user-friendly.

Add a backspace button to the story board and connect it to an action function “backSpace”, which basically does nothing if the user is not in the middle of entering a number, otherwise removes the last digits from display and history or writes a zero to display if there is only one digit left:
Continue reading “Assignment #1 Extra Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail