I have an NSMutable array which contains some objects and I want to store these objects into a different Mutable array in the form of different arrays.
For ex: I have an array named sessionArrayType4 which has these objects.
"New Attendee Reception",
"Attendee Reception",
"Banquett",
"Tour and BBQ"
And I want to store in another Mutable array named globalSessionArray and I'm expecting result something like below.
(("New Attendee Reception"), ("Attendee Reception"), (Banquett), (Tour and BBQ))
Here is my code:
if(self.pickerSelectedRow == [self.typePickerArray objectAtIndex:3])
{
for (int i =0; i< [self.sessionArrayType4 count]; i++)
{
if(self.displayTime == [[self.sessionArrayType4 objectAtIndex:i]valueForKey:@"start_time"])
{
[self.sessionRowArray addObject:[[self.sessionArrayType4 objectAtIndex:i]valueForKey:@"session_name"]];
self.rowCount = self.rowCount + 1;
}
else
{
[self.sessionRowArray removeAllObjects];
self.displayTime = [[self.sessionArrayType4 objectAtIndex:i] valueForKey:@"start_time"];
[self.sessionRowArray addObject:[[self.sessionArrayType4 objectAtIndex:i]valueForKey:@"session_name"]];
[self.globalSessionArray addObject:self.sessionRowArray];
}
}
}
But I am getting output something like this:
((Tour and BBQ), (Tour and BBQ), (Tour and BBQ), (Tour and BBQ))