내 iPhone 응용 프로그램에서.하나의 변경 가능한 배열을 다른 "복사"할 수 없습니다
하나의 변경 가능한 배열 (사전 포함)을 다른 배열로 복사 중입니다.
그것은
resultsToDisplay = [[[NSMutableArray alloc]initWithArray:resultsPassed]mutableCopy];
2012-06-21 17:07:07.441 AllinoneCalc[3344:f803] Results To Display (
{
lbl = "Monthly EMI";
result = "75.51";
}
)
2012-06-21 17:07:08.224 AllinoneCalc[3344:f803] Results Passed (
{
lbl = "Monthly EMI";
result = "75.51";
}
)
그럼 내가 그들 중 하나를 수정하고 같다.
[[resultsToDisplay objectAtIndex:i] setValue:[NSString stringWithFormat:@"%.2f",[[[resultsPassed objectAtIndex:i] valueForKey:@"result"] floatValue]] forKey:@"result"];
하지만 둘 다 편집 중입니다.
2012-06-21 17:07:08.703 AllinoneCalc[3344:f803] Results Passed (
{
lbl = "Monthly EMI";
result = "75.00";
}
)
2012-06-21 17:07:08.705 AllinoneCalc[3344:f803] Results To Display (
{
lbl = "Monthly EMI";
result = "75.00";
}
)
둘 다 동일한 사본을 나타냅니다.
어떻게 해결할 수 있습니까? 하나의 배열 만 수정하고 싶습니다.
그냥'resultsToDisplay = [[NSMutableArray alloc] initWithArray : resultsPassed]'또는'resultToDisplay = [resultsPassed mutableCopy]'를 사용하면 어떻게됩니까? –