3

I have an NSMutableArray something like this

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

and I access this array for particular object like

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

what I am trying to do is to copy all elements which are in array.b into an another array say arrayABC.

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

HOw can i do that.. suggestions are always appreciated..

regards

3 Answers 3

6

You could use the "arrayWithArray" 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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks mate...i finally got it running. thanks for replying man..i am upvoting u for the link
0

i think i got my answer by myself

[newArray addObject:array.A];

it works for me....

Comments

0

Swift version for the checked response :

let array = NSArray(array: myarray)

Also for mutable array :

let array = NSMutableArray(array: mymutablearray)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.