开发者

Adding two arrays together

开发者 https://www.devze.com 2022-12-30 02:41 出处:网络
开发者_C百科I call two feeds that both return an NSMutableArray, I then need to make the two arrays into one.
开发者_C百科

I call two feeds that both return an NSMutableArray, I then need to make the two arrays into one.

NSMutableArray *array1 = [JSONWrapper downloadFeed];
NSMutableArray *array2 = [JSONWrapper downloadFeed];

// something like: array1 += array2


Use -addObjectsFromArray::

[array1 addObjectsFromArray:array2];


NSArray *newArray = [array1 arrayByAddingObjectsFromArray:array2];
0

精彩评论

暂无评论...
验证码 换一张
取 消