Defining the View Controller

Now, let’s write the code for the view controller class ViewController. We start with the interface file Program 21.2.

Program 21.2. ViewController.h Interface File

#import <UIKit/UIKit.h>@interface ViewController : UIViewController@property (strong, nonatomic) IBOutlet UILabel *display;-(void) processDigit: (int) digit;-(void) processOp: (char) theOp;-(void) storeFracPart;// Numeric keys-(IBAction) clickDigit: (UIButton *) sender;// Arithmetic Operation keys-(IBAction) clickPlus;-(IBAction) clickMinus;-(IBAction) clickMultiply;-(IBAction) clickDivide;// Misc. Keys-(IBAction) clickOver;-(IBAction) clickEquals;-(IBAction) clickClear;@end

There are housekeeping variables for building the fractions (currentNumber

Get Programming in Objective-C, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.