I’m iterating a NSArray in objective-c with:
for (id object in array1) {
...
}
I now have another array2, and I need to access with the same index of the current array1.
Should I use another for statement ?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have several options:
Use c-style for loop as Dan suggested
Keep track of current index in a separate variable in fast-enumeration approach:
Use
enumerateObjectsUsingBlock:method (OS 4.0+):