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];
but have to remove it again fur further entries. We can do this using a helper function
- (void)removeEqualSignFromHistory; { NSRange range = [self.history.text rangeOfString:@"="]; if (range.location == NSNotFound) return; NSString *history = [self.history.text copy]; self.history.text = [history substringToIndex:([history length] - 2)]; }
which we call every time we need to (before changing the history):
[self removeEqualSignFromHistory];
![Share on Facebook Facebook](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/facebook.png)
![Share on Twitter twitter](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/twitter.png)
![Share on Reddit reddit](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/reddit.png)
![Pin it with Pinterest pinterest](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/pinterest.png)
![Share on Linkedin linkedin](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/linkedin.png)
![Share on tumblr tumblr](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/tumblr.png)
![Share by email mail](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/16x16/mail.png)
![Share on Facebook Facebook](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/facebook.png)
![Share on Twitter twitter](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/twitter.png)
![Share on Reddit reddit](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/reddit.png)
![Pin it with Pinterest pinterest](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/pinterest.png)
![Share on Linkedin linkedin](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/linkedin.png)
![Share on tumblr tumblr](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/tumblr.png)
![Share by email mail](https://cs193p.m2m.at/wp-content/plugins/social-media-feather/synved-social/image/social/regular/32x32/mail.png)