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

New Topic/Question
Reply


MultiQuote




|