Assignment #3 Task #4

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

Anytime a graph is on screen, the description of the program used to draw it (e.g. the result of your +descriptionOfProgram: method) should also be shown on screen somewhere sensible. This might be a different place on the iPhone versus the iPad.

As the description only changes when the program changes, we will run this task when the program is set, and put the description – if there is any – in the title:

- (void)setProgram:(id)program {
    _program = program;
    NSString *formula = [CalculatorBrain descriptionOfProgram:program];
    if ([formula isEqualToString:@""]) formula = @"Graph";
    self.title = formula;
}
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Leave a Reply

Your email address will not be published.