I have a class Person with variables name,age,local and about, i added values of person object to a mutable array as shown:
Person *myPerson=[[Person alloc]init];
NSMutableArray *personArray=[[NSMutableArray alloc]init];
myPerson.name=namefield; //'namefield' retrieved from db
myPerson.age=agefield; //'agefield' retrieved from db
myPerson.local=locfield; //'locfield' retrieved from db
myPerson.about=aboutfield; //'aboutfield' retrieved from db
[personArray addObject:myPerson];
and I have problem when trying to print out the elements using below code;which shows last element repeatedly,
for (int i = 0; i < [personArray count]; i++){
Person * p = [personArray objectAtIndex:i];
NSLog(@"name %@",p.name);
NSLog(@"age %@",p.age);
}
hope you will be kind to me as I am a new guy to iPhone development. Thanks.