I am working on an educational game for a local school system, in this game students are presented with six numbers and they have to try and use as many of them as they can to equal a seventh number, the numbers are stored in an array called currentHand, and the numbers need to be displayed as text on buttons present on the screen. The catch is, as they combined numbers together the values on the buttons need to change accordingly. Say I add two buttons a button with the value 1 and a button with a value 2, the value three gets added to the array and the values 1 and 2 are deleted, then one button needs to become invisible and the other needs to be updated with the value 3. I was told to try this with an IBOutletCollection, but because I am still very new to objective C, I have no idea how to use an IBOutCollection to do this, I had an idea to create a method that would tie each button to an element in the array, as the list shrank in size so would the number of buttons, so if you had the numbers
{1,2,3,4,5,6}
each button would have one value assigned to them, but as the list changed to say
{1,2,3,4,11}
the button displaying the number 6 would disappear and the button holding the number 5 would change to 11, but as I said I have no idea how to accomplish this.
As I cannot display pictures being such a new member, I have linked one to how I tried to set up the IBOutletCOllection
and below is the code that instantiates currentHand
-(NSMutableArray *) currentHand{
if (_currentHand == nil) {
_currentHand = [[NSMutableArray alloc]init];
}
self.currentHand = self.myDeck.giveHand;
return _currentHand;
}
Any advice on this would be greatly appreciated, thanks in advanced.