배열이 있고 배열을 반복하면서 항목을 바꾸기를 원했습니다. 이럴 수는 없나요? 코드는 다음과 같습니다.동시에 항목 반복 및 바꾸기
for (int i = 0; i < [highlightItemsArray count]; i++){
//replace the from array with the new one
NSMutableDictionary *tempDictionary = [NSMutableDictionary dictionaryWithDictionary:highlightItem];
[tempDictionary setObject:[newHighlightItem objectForKey:@"from"] forKey:@"from"];
[highlightItemsArray replaceObjectAtIndex:i withObject:tempDictionary];
[indexes addIndex:i];
}
객관적으로 C가 정당한 것인지 알고 싶습니까? 그렇지 않다면 그렇게하는 대안은 무엇입니까?
같은 그것은이 경우에만 실패 어떤 충돌 –
가 발생하지 않습니다 당신은 '빠른 열거 형'(배열 {}에서 id 객체에 대해)을 사용하고있었습니다. 자신이하는 일을 성취하기위한 간단한 방법이있을 수 있지만, 정확히 무엇을 달성하려고하는지 확신 할 수 없습니다. – MaxGabriel