Concatenation of two arrays in Objective-C

前端 未结 3 1510
我在风中等你
我在风中等你 2021-02-06 21:42

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

3条回答
  •  甜味超标
    2021-02-06 22:01

    NSSArray *theArrayIReallyWant = [oneArrayIDontReallyWant arrayByAddingObjectsFromArray:otherArrayIDontReallyWant];
    

    If you need to, retain theArrayIReallyWant so it stays in memory, just be sure to release it when you are done. That by far is the easiest method :)

提交回复
热议问题