我有一个NSMutableArray只会在会话期间持续。 目前我创建像这样如何创建新鲜的NSMutableArray?
NSMutableArray *temp = [[NSMutableArray alloc] initWithCapacity:10];
[self setScoreArray:temp];
[temp release];
问题是,当我去检查每个索引我得到一个数组outofbounds错误
NSNumber *previousScore = [[self scoreArray] objectAtIndex:[self quizNum]];
if (previousScore != nil)
{
[self clearQuizBtns];
NSInteger previousScoreValue = [previousScore integerValue];
[self selectButtonAtTag:previousScoreValue];
}else {
[self clearQuizBtns];
}
我在其他职位读取initWithCapacity不实际上创建数组。那么我最初可以填充数组呢? 在此先感谢。
谢谢。很多答案都很棒。我非常感谢帮助。 – intomo 2011-01-25 20:18:00