1 Replies - 4741 Views - Last Post: 29 July 2012 - 09:55 PM

#1 walsby14  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-July 12

calculation issue

Posted 27 July 2012 - 03:45 AM

Should be an easy answer but i have no idea how to do it,

I basically have two labels which contain a number that can be changed by a stepper, a different stepper for each label. I want to then add the two numbers in the labels and out put the result in a new label by pressing a button.

Here is my current code for the labels and steppers:


- (IBAction)creditChange:(UIStepper *)sender {
    
    double value = [sender value];
    [creditBalance setText:[NSString stringWithFormat:@"%d", (int)value]];
}

- (IBAction)debitChange:(UIStepper *)sender {
    
    double value = [sender value];
    [debitBalance setText:[NSString stringWithFormat:@"%d", (int)value]];
}




That is in the .m file. here is the .h file


@interface BalanceViewController : UIViewController {

    IBOutlet UILabel *creditBalance;
    IBOutlet UILabel *debitBalance;
}

- (IBAction)creditChange:(UIStepper *)sender;
- (IBAction)debitChange:(UIStepper *)sender;

@end




I haven't yet added the third label which will be called total, or the IBAction for the UIButton.

Any help would be greatly appreciated :D

Is This A Good Question/Topic? 0
  • +

Replies To: calculation issue

#2 erewnoh  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 71
  • Joined: 01-March 09

Re: calculation issue

Posted 29 July 2012 - 09:55 PM

It sounds like you know what you need to do. What exactly do you need help with?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1