Please note, this blog entry is from a previous course. You might want to check out the current one.
Add a Graph button to your calculator’s user-interface that, when pressed, segues to a new MVC (that you will have to write) by pushing it onto the UINavigationController’s stack (on the iPhone). The new MVC graphs whatever program was in the calculator when the button was pressed. To draw the graph you will iterate over all the pixels in your view horizontally (x) and use +runProgram:usingVariableValues: to get the corresponding vertical (y) value. You will, of course, have to convert to/from your view’s coordinate system from/to a reasonable graph coordinate system. You will need a scale and origin to do this coordinate system conversion. If the user has not already chosen a scale and origin for the graph (see Required Tasks 7 & 8 below), pick a reasonable starting scale and origin.
… and still inside your storyboard, drag out a new view controller, place a new button called “Graph” into your calculator view controller and create a push segue from your new button to your new view controller.
Continue reading “Assignment #3 Task #3”