I am quite new to iOS programming. Can anyone help me on how to create two buttons (button 1 and button 2) that add integers (integer 1 and integer 2) to a Mutable array when each button is clicked? Means that when Button 1 is clicked, integer 1 is added to the mutable array, and when integer 2 is clicked, integer 2 will be added to the mutable array. I understand we need to create an instance of the mutable array before we can use the array, but I'm not sure where is the best place to do that?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSMutableArray *inputArray = [[NSMutableArray alloc] init];
}
- (IBAction)Button1:(id)sender {
int _userinput = 1;
NSNumber *userinput = [NSNumber numberWithInteger:_userinput];
[self.inputArray addObject:userinput];
NSLog(@"%@", self.inputArray[0]);
}