Quote:
Originally Posted by Ajaxx
Hi,
I am developing my first app and is using quite a few arrays to keep data.
I have been thinking about why (and when) to use NSArray over NSMutableArray?
Cheers
|
Hi Ajaxx, I'm also in the process of creating my first app although coming towards the end now. When you grasp Arrays they are amazing! Someone may correct me but from what I understand...
NSArrays are immutable (the data inside them can't be changed)
NSMutableArrays are mutable (the data inside them can be changed)
So, if you just want to hold data and refer to it - use NSArrays.
If you want the data to be changable (i.e. using the replaceObjectAtIndex or addObject methods - Use NSMutableArrays.
hope that helps, if not the search facility will find you a dozen other answers to this I imagine, good luck!