展平NSArray [英] Flatten an NSArray

查看:110
本文介绍了展平NSArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的数组:

array: (
    (
        "http://aaa/product/8_1371121323.png",
        "http://aaa/product/14_1371123271.png"
    ),
    (
        "http://aaa/product/9_1371121377.png"
    )
)

数组。

array: (
    "http://aaa/product/8_1371121323.png",
    "http://aaa/product/14_1371123271.png",
    "http://aaa/product/9_1371121377.png"
)

我该怎么办?是否可以组合所有的对象和使用一些字符串分隔?

How can I do that? Is it possible to combine all the objects and separate them using some string?

推荐答案

示例代码

NSMutableArray *mainArray = [[NSMutableArray alloc] init];
for (int i = 0; i < bigArray.count ; i++)
{
     [mainArray addObjectsFromArray:[bigArray objectAtIndex:i]];
}
NSLog(@"mainArray :: %@",mainArray);

这篇关于展平NSArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆