我试图在此函数调用 时将随机数添加到此数组的末尾。到目前为止,我已经缩小了它的范围。 当我检查,看看是否有任何数组,它说0. 所以现在我很难住。我在考虑MutableArray在我使用它们之前发布它的内容。问题是我不知道该用什么。一个按钮调用函数,几乎所有其他的东西都被处理掉了。向数组添加整数
NSMutableArray * choices;
-(void) doSomething {
int r = arc4random() % 4;
//The problem...
[choices addObject:[NSNumber numberWithInt:r]];
int anInt = [[choices objectAtIndex:1] integerValue];
NSLog(@"%d", anInt);
//I'm getting nothing no matter what I do.
//some type of loop that goes through the array and displays each element
//after it gets added
}
我环顾四周,我没有看到它如何不诚实地工作。 – Ohmnastrum 2010-05-21 20:49:43