Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

nsarray - Concatenation of two arrays in Objective-C

How to concatenate two arrays into a single array in Objective-C?

question from:https://stackoverflow.com/questions/4154502/concatenation-of-two-arrays-in-objective-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
NSArray* newArray = [firstArray arrayByAddingObjectsFromArray:secondArray];

Or using mutable array version just add to it all objects from another array:

[myMutableArray addObjectsFromArray:secondArray];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...