my problem is, i have a NSMutableArray of 3 objects :
[myMutableArray insertObject :Obj1 atIndex:0];
[myMutableArray insertObject :Obj2 atIndex:1];
[myMutableArray insertObject :Obj3 atIndex:3];
And then, insert atIndex0 the Obj3. After that, i want to "push" my mutable array as index1 become my first index.
I saw that NSMutableData could be interesting but i don't know how to use it. Is it possible ?
I already try to use NSMUtableData but, don't know how to handle it.
Thanks a lot...
答案 0 :(得分:0)
您可以使用这些方法将对象推送到NSMutableArray:
到头开始
[myMutableArray insertObject:obj1 atIndex:0];
[myMutableArray insertObject:obj2 atIndex:0];
如果索引已被占用,则索引处及以后的对象为 通过在他们的指数上加1来腾出空间。 (苹果)
到最后
[myMutableArray addObject:obj1];
[myMutableArray addObject:obj2];
要添加到数组内容末尾的对象。该值不得为零。 (苹果)