我正在创建一个简单的骰子游戏,现在我正试图通过for循环来触及我的属性。这有意义吗?这是代码,问题显示在最后一行。
- (IBAction)throwDice {
//Create an array with the image objects
NSArray *diceNr = @[_dieOne, _dieTwo, _dieThree, _dieFour, _dieFive];
//For each image object, get a random number 0-5
//and place the associated image for this number in the image object
for (id dices in diceNr) {
NSUInteger dieIndex = arc4random_uniform(6);
NSArray *diceValue = @[@"one", @"two", @"three", @"four", @"five", @"six"];
NSNumber *dice = diceValue[dieIndex];
self.dices.image = dice;
}
}