How to add object at first index of NSArray

后端 未结 10 666
离开以前
离开以前 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条回答
  •  隐瞒了意图╮
    2021-02-01 06:24

    As you are allready having 10 objects in your array,and you need to add another item at index 11...so,you must try this.... hope this helps..

    NSMutableArray *yourArray = [[NSMutableArray alloc] initWithCapacity:11];
    [yourArray insertObject:@"All Items" atIndex:0];
    

提交回复
热议问题