Reputation: 1562
I have a person with setter / getter... Now i'm looping an array of that person object. how do i assign the element to a new person.
for (int i =0; i<[people count]; i++)
{
Person *p = [people objectAtIndex:i];
nsLog(@"%@", [p id]);
}
Upvotes: 0
Views: 126
Reputation: 2201
well you're doing it right, except nslog...it should be: NSLog("%@",p);
as for a speed thing...use fast enumeration..like this:
for(Person *person in people){
//some assign code (Person *p=person);
NSLog("%@",person);
}
note that i don't know how Person
is created...if there is a problem it's there
Upvotes: 1