What is the difference between:
[blah addObject:@"1"];
And
[blah insertObject:@"0" atIndex:0];
???
I know they’re both for a NSMutableArray.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
addObjectadds an object at last.insertObject:atIndexadds an object at specified index. All objects further to that specified index are shifted one position right.For example, say you have an array with following objects:
And you add E using
addObject. Then it will look like:Then you insert F at index 2. Then it will look like: