`- (void)viewDidLoad{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSInteger *pushUpCount;
}
`- (IBAction)imPressed:(id)sender {
NSInteger pushUpCount = pushUpCount + 1;
NSString *strPushUp = [NSString stringWithFormat:@"%d", pushUpCount];
NSLog(strPushUp);
}
No my problem is that it says that the pushUpCount is not declared. So I was wondering how could I make this "public", so that all of the of the functions or IBActions can use this variable. I know what the problem is I don't know how to fix it.
CODE EXPLANATION
All I'm doing here is setting the variable to 0. Before the user does anything. Then each time the button is pressed it will add 1 to the existing number. then I will change the text of a NSTextField to the number but I know how to do that.(or I think I do at least).
So my basic question is..... How can I reuse a variable in another function or IBAction
Thanks in advance.