Copy array to another array

I have NSMutableArraysomething like this

array =[[a1,b1,c1],[a2,b2,c2],[a3,b3,c3].......]

and I get access to this array for a specific object, for example

array.a =[a1,a2,a3]
array.b =[b1,b2,b3]

what I'm trying to do is copy all the elements that are in array.bto another array, say arrayABC.

something like that arrayABC = [a1,a2,a3....]

HOw can I do this .. suggestions are always welcome.

considers

+3
source share
3 answers

You can use the classWithArray class method in NSArray:

NSArray *newABC = [NSArray arrayWithArray:someOtherArray];

See http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html%23//apple_ref/doc/uid/20000137-BABCADBE

+6
source

I think I got my answer myself.

[newArray addObject: array.A];

....

0

:

let array = NSArray(array: myarray)

:

let array = NSMutableArray(array: mymutablearray)
0

Source: https://habr.com/ru/post/1764825/


All Articles