いくつかのオブジェクトを含む配列があり、NSMutable
これらのオブジェクトを異なる配列の形式で別の Mutable 配列に格納したいと考えています。
例: これらのオブジェクトを持つ sessionArrayType4 という名前の配列があります。
"New Attendee Reception",
"Attendee Reception",
"Banquett",
"Tour and BBQ"
そして、globalSessionArray という名前の別の Mutable 配列に格納したいので、以下のような結果を期待しています。
(("New Attendee Reception"), ("Attendee Reception"), (Banquett), (Tour and BBQ))
これが私のコードです:
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];
}
}
}
しかし、私は次のような出力を得ています:
((Tour and BBQ), (Tour and BBQ), (Tour and BBQ), (Tour and BBQ))