Array replacing previously added object.
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);
Problem is that as I insert the object, previously existing object gets replaced.
How may I do this?