如何将数组值初始化为另一个新数组

时间:2011-01-17 07:20:38

标签: iphone

我有阵列distanceListArray .. 5公里,10公里,15公里,20公里,25公里。 distanceListArray是appDelegate.class

distanceArray计数为5。

现在我有另一个阵列。

包含事件数据列表......

eventListArray属于DistanceClass

调用eventListArray。 5公里,它显示10个事件,10公里显示20个事件。

现在我需要将eventListArray的distanceListArray中的每个部分的数据加载到另一个新数组中。

所有阵列都是NSMutableArray。

我希望这会产生歧义。

请帮助我帮忙。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。它正在发挥作用,但我不知道在我的搜索中会发生什么。

newArray = [[NSMutableArray alloc] init];
for (int i=0; i<=4; i++) {
    for (EventInfo *string in [[appDelegate.distanceListArray objectAtIndex:i] eventListArray]) {
        NSLog(@"String is %@",string.event_Title);
        [newArray addObject:string];
    }
}