I am trying to copy elements from NSMutableArray to another.
I add elements to their first two MutableArray ( storiesRSS1and storiesRSS2):
[item setObject:currentTitle forKey:@"title"]
[item setObject:currentLink forKey:@"link"]
[item setObject:currentSummary forKey:@"summary"]
[item setObject:currentDate forKey:@"date"]
[item setObject:currentImage forKey:@"image"]
[item setObject:currentMovie forKey:@"movie"]
[storiesRSS1 addObject:[item copy]]
[item setObject:currentTitle forKey:@"title"]
[item setObject:currentLink forKey:@"link"]
[item setObject:currentSummary forKey:@"summary"]
[item setObject:currentDate forKey:@"date"]
[item setObject:currentImage forKey:@"image"]
[item setObject:currentMovie forKey:@"movie"]
[storiesRSS2 addObject:[item copy]]
For these two arrays, it works.
After that, I want to mix both in the third array ( stories).
int i=0;
int nbElement=[storiesRSS1 count]+[storiesRSS2 count];
while (i<nbElement) {
if (i<[tempArrayTed count]) {
[stories addObject:[storiesRSS1 objectAtIndex:i]];
}
if (i<[tempArrayYoutube count]) {
[stories addObject:[storiesRSS2 objectAtIndex:i]];
}
i++;
}
But when I try to show every element, it is always null!
Could you help me, thanks.
source
share