I have a IBAction UILabel to add a number every time it is pressed. I have a Total UITextField that a adds all 3 UILabels. Getting the total seems to be fine until I hit the subtract(buttonTap2) UILabel button.
Here is an example of the IBAction UILabel code not working:
- (IBAction)buttonTap2:(id)sender {
int value = [currentLabel.text intValue] - 1;
currentLabel.text = [NSString stringWithFormat:@"%d",value];
int n1 = [label2.text intValue]; // total labels
int n2 = [label3.text intValue];
int n3 = [label4.text intValue];
int s = n1 - n2 - n3;
NSString *sn = [NSString stringWithFormat:@"%d",s];
[tex7 setText:sn];
What problem are you having? What is “tex7”? If it’s supposed to be a textfield or label, is it correctly linked up in Interface Builder? You might have missed it as it isn’t very descriptive.