Hey guys i have a label and you can + or - 1 from the label so its like a counter. And when it hits 0 from subtracting so many times, I want the button to stop working. I got it to do this. But my problem is getting the button to start working again after the value is anything greater than 0. Here is my code:
Code:
- (IBAction)subtractButton:(id)sender {
int val = [label.text intValue];
[label setText:[NSString stringWithFormat:@"%d",[label.text intValue] -1]];
if(val - 1 <= 0) {
UIButton *button = (UIButton *)sender;
[button setEnabled:NO];
}
}
Thanks in advance for all the help everybody!