How to add object at first index of NSArray

后端 未结 10 677
离开以前
离开以前 2021-02-01 06:03

I want to add @\"ALL ITEMS\" object at the first index of NSARRAY.

Initially the Array has 10 objects. After adding, the array should contains 11 objects.

10条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 06:25

    NSArray is immutable but you can use insertObject: method of NSMutableArray class

    [array insertObject:@"all items" atIndex:0];
    

提交回复
热议问题