The method can look like this:
- (IBAction)button_increase_click:(id)sender {
int number = [self.label_content.text intValue];
number++;
self.label_content.text = [NSString stringWithFormat:@"%04d", number];
}
Update For increasing readability use camel case for ivar method and other names. It’s standard for iOS.
- (IBAction)increaseValue:(id)sender {
int number = [self.contentLabel.text intValue];
number++;
self.contentLabel.text = [NSString stringWithFormat:@"%04d", number];
}
0
solved Objective-C: Improve function