I have following code :
- (IBAction)goButton:(id)sender
{
if(buttonCount==0)
{
previousStateArray=setUpArray;
NSLog(@"previous array count=%d",[previousStateArray count]);
[setUpArray removeAllObjects];
for(Node *n in nodeArray)
{
if(![temp isEqualToString:n.strName])
{
[setUpArray addObject:n.strName];
}
temp=n.strName;
}
}
}
- (IBAction)backButton:(id)sender
{
[setUpArray removeAllObjects];
setUpArray=previousStateArray;
NSLog(@"previous array count=%d",[previousStateArray count]);
buttonCount--;
}
Both setUpArray and previousStateArray are declared in the -viewDidLoad method.My view is loading only once.In first NSLog i am getting 1 as a output but in second NSLog i am getting
0 as a output while none of my array initialize again . so why this is happening???