Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

initWithCapacity: in NSArray

Tags:

iphone

initWithCapacity: is declared in NSMutableArray, but I want to use it to initialize an NSArray. I there any solution?

like image 288
senthil Avatar asked Oct 01 '09 09:10

senthil


1 Answers

Since NSArray objects are immutable (cannot change the objects they contain) there's no use in adjusting the capacity of NSArrays.

The capacity is the number of objects an array can contain without reallocating memory. It is only used for optimization.

like image 174
Nikolai Ruhe Avatar answered Nov 03 '22 02:11

Nikolai Ruhe