I am making a program to that basically does a calculation (making a little points calculator for some family).... obviously I am new to Obj-C and am using other code as a guide to learning my own. The Interface is fine..... but my code seems screwed. I am taking 3 fields and calculating and then presenting the output. Anytime the a field changes it needs to recalculate. here is the code....
Any advice on my errors?
UPDATE: Made a couple of changes... Still does not react like I was expecting.
Any advice on my errors?
UPDATE: Made a couple of changes... Still does not react like I was expecting.
Code:
#import "PointCalculator.h"
@implementation PointCalculator
+ (void)initialize
{
[PointCalculator setKeys:
[NSArray arrayWithObjects:@"inputFiber", nil]
triggerChangeNotificationsForDependentKey:@"outputPoints"];
[PointCalculator setKeys:
[NSArray arrayWithObjects:@"inputCalories", nil]
triggerChangeNotificationsForDependentKey:@"outputPoints"];
[PointCalculator setKeys:
[NSArray arrayWithObjects:@"inputFat", nil]
triggerChangeNotificationsForDependentKey:@"outputPoints"];
}
- outputPoints
{
result = inputCalories+inputFat+inputFiber;
return result;
}
@end
Code:
/* PointCalculator */
#import <Cocoa/Cocoa.h>
@interface PointCalculator : NSObject
{
int inputCalories;
int inputFat;
int inputFiber;
int result;
}
- outputPoints;
@end