0
複製對象的正確方法,所以我想從一個NSMutableArray
複製對象:什麼是從一個NSMutableArray
self.myObject = [self.myMutableArray objectAtIndex:self.currentIndex];
但當currentIndex
變化,myObject
變化對應於新的索引的對象。
解決此問題的最佳方法是什麼?
編輯:
這裏或多或少我想要實現:
self.currentIndex = 0;
self.myObject = [self.myMutableArray objectAtIndex:self.currentIndex];
self.currentIndex = 1;
//After here I want myObject to remain the same, but it doesn't
沒有足夠的信息來正確回答這個問題:如果你不知道對象的索引,你需要知道somet除此之外,還可以讓你唯一地識別你的對象。請告訴我們是什麼使得您需要從數組中獲取的對象與其他索引中的對象不同。 – dasblinkenlight 2012-04-03 12:27:25
你的問題不清楚...所以你想讓你的對象改變或不改變? – skytz 2012-04-03 12:29:39
對不起,我剛更新了它。 – sooper 2012-04-03 12:30:45