for my iOS app I want to initiate an NSMutableArray and change the Object the array holds during runtime with buttons. So far I was able to initiate an array in viewDidLoad {} in the ViewController.m but now i can't access it in my buttonPressed method. How can I make the array accessible for the hold file?
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSMutableArray *toCalculate = [@[@0] mutableCopy];
}
- (IBAction)numbersButtonsPressed:(UIButton *)sender {
NSLog(@"%ld\n", sender.tag);
[toCalculate addObject:[NSNumber numberWithLong:sender.tag]];
}