我這種情況IOS:NSMutableArray的initWithCapacity
array = [[NSMutableArray alloc] initWithCapacity:4]; //in viewDidLoad
if (index == 0){
[array insertObject:object atIndex:0];
}
if (index == 1){
[array insertObject:object atIndex:1];
}
if (index == 2){
[array insertObject:object atIndex:2];
}
if (index == 3){
[array insertObject:object atIndex:3];
}
,但如果我爲了物體插入它的一切OK,而是如果我填的是陣列順序:0和3之後,不工作好,爲什麼?
你試圖在4插入對象索引嗎? – saadnib 2011-04-22 11:11:45
不.....我試着插入對象在索引0和後在索引2,但它不工作 – CrazyDev 2011-04-22 11:13:42