Hey guys,
Basically I've been trying to make a working hours calculator and I've run into a problem. When the start time's value is greater than the finish time (eg. start is 23 and finish is 19), the result comes up as a negative. So what I want it to do in that scenario is to then multiply the negative number by -1 to make it positive again. However, this code below doesn't seem to have any effect in my app.
-(IBAction)done:(id)sender {
int result = [finishHours.text intValue] - [startHours.text intValue];
totalHours.text = [NSString stringWithFormat:@"%i", result];
if (result < 0) {
result = result * -1;
}
Any help would be greatly would be greatly appreciated. :)