cs193p – Project #3 Assignment #3 Task #3

Tullius at the German language Wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)], via Wikimedia Commons

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

Add a new button to your calculator’s user-interface which, when touched, segues to a new MVC (that you will have to write) which graphs the program in the CalculatorBrain at the time the button was touched using the memory location M as the independent variable. For example, if the CalculatorBrain contains sin(M), you’d draw a sine wave. Subsequent input to the Calculator must have no effect on the graph (until the graphing button is touched again).

Currently we have not really space left to add another button. For now add the graph button in the top left corner – maybe we move it in the extra tasks later on – and add some sensible autolayout constraints.

cs193p - Project #3 Assignment #3 Task #3 - Graph Button
cs193p – Project #3 Assignment #3 Task #3 – Graph Button


… and for the fun of it, make it an image button. Add the needed images to the image assets and use them in storyboard:

cs193p - Project #3 Assignment #3 Task #3 - Graph Button Images
cs193p – Project #3 Assignment #3 Task #3 – Graph Button Images
cs193p - Project #3 Assignment #3 Task #3 - Button Settings
cs193p – Project #3 Assignment #3 Task #3 – Button Settings

Finally add a new class file for the graph-view controller to the project. Add a new view controller to storyboard and link it to the just created class. Create a segue (show detail) from the graph button to the new view controller and give it a sensible identifier. Because those steps do not really a lot change the background color of the view of the new view controller to see if actually something is happening when we click the button …

cs193p - Project #3 Assignment #3 Task #3 - Add Graph-View Controller and Segue
cs193p – Project #3 Assignment #3 Task #3 – Add Graph-View Controller and Segue

Further missing details from this tasks will be handled in the following tasks …

The complete code for the task #3 is available on GitHub.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *