I'm trying to return the value of "totaal" in an NSLog()
message. If I put all the code in the - (IBAction)txtChangeEinde:(id)sender
it works fine, I'm just trying to figure out how those methods and classes work.
@implementation Oak
@synthesize txtEinde,txtBegin,cboSchaal;
- (float)berekenTotaal:(float) totaal{
begin = [txtEinde floatValue];
einde = [txtBegin floatValue];
if (begin<0) {
begin= begin*-1;
}
totaal = begin + einde;
return totaal;
}
- (IBAction)txtChangeEinde:(id)sender {
//where it goes wrong!
NSLog(@"totaal: %.2f",[berekenTotaal totaal]);
}