Leave a Reply

28 Comments on "Objective C Programming Tutorial – 58 – Mutable Arrays"

Notify of
avatar

7lasch
Guest
4 years 16 days ago

I there, 
I'm working your tutorial and i would like to ask you something.
Shouldn't the first element value start with 6.
The first time you are in the loop, the value of i is equal to 6.

Thanks!

carlosyalluh
Guest
4 years 4 months ago

Just wondering why you need to do this funky turning numbers into objects instead of just saying array[x] like in c++

Joshua Matthews
Guest
Joshua Matthews
4 years 8 months ago

I know this was a year ago but to the future people that read this, the newer xcode versions use intValue instead of integerValue as the method to change the NSNumber object into an integer.

alexander seutin
Guest
alexander seutin
5 years 4 months ago

why numberWithInteger instead of numberWithInt

Megatron
Guest
Megatron
5 years 6 months ago

removeObjectAtIndex:

you can look at API for other methods.

TheJeeves2020
Guest
TheJeeves2020
5 years 8 months ago

how do you remove an object in the array?

juliand665
Guest
juliand665
5 years 9 months ago

Thanks! 😀

MrAstroKind
Guest
MrAstroKind
5 years 9 months ago

I hope you don't mind my answer to a 2-month question but you can create an NSMutable array with size 0 but it's better in practice to initWithCapacity in order to reserve the memory in advance (if you can estimate the size) in order to increase performance. Good question!

benmuskler
Guest
benmuskler
6 years 2 days ago

You've probably already found out by now, but you could do it like this:
[changme removeObjectAtIndex:0];
that would remove the first object in the array. Hope that helps ^^

juliand665
Guest
juliand665
6 years 3 days ago

Then why doesn't one just always create an array with size 0?

1 2 3
wpDiscuz