I have a number of objects in NSArray. I want to reconstract NSMutableArray of NSMutableArrays with 6 elements in each out of NSArray. How can I do it?
Edit
My code:
NSArray *newsList = [mynode6 findChildTags:@"td"]; //result of site parsing
NSMutableArray *someArray = [[NSMutableArray alloc] init];
int i=0;
for (HTMLNode *news in newsList) {
[someArray addObject:[newsList objectAtIndex:news];
i++;
if (i==5) {
i=0;
[self.valueArray addObject:someArray];
[someArray removeAllObjects];
}
}
valueArray is my main NSMutableArray. This code does not work, valueArray is empty.
Quick fix:
Allocate the array within your loop: