Probably a noob question, but I'm trying to write a simple iPhone app that increments a label by the number of times a button is clicked. I have the following code:
#import "Controller.h"
int *i = 0;
@implementation Controller
- (IBAction)buttonClicked:(id)sender {
NSString *numTimesClicked = [NSString stringWithFormat:@"%d",i++ ];
myLabel.text = numTimesClicked;
}
@end
When I click the button, the label updates in multiples of 4 (4,8,12,16, etc). What might I be doing wrong here?