数组替换先前添加的对象。
array=[[NSMutableArray alloc]init];
NSNumber * index;
AppDelegate * delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
if(delegate.counter!=NumberImages.count)
{
NSLog(@"%d",delegate.counter);
imgview.tag=delegate.counter;
NSLog(@"%ld",(long)imgview.tag);
index=[[NSNumber alloc]initWithInt:[[firstNo objectAtIndex:imgview.tag]integerValue]];
//int a=[[firstNo objectAtIndex:imgview.tag]integerValue];
NSLog(@"%@",index);
NSLog(@"%@",array);
}
[array addObject:index];
NSLog(@"%@",array);
问题是当我插入对象时,先前存在的对象被替换。
我该怎么做?