0

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]);
}
1
  • 1
    What is your problem. Your question is not clear. Can you please elaborate more ? Commented May 19, 2012 at 9:43

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.