Παρασκευή, 20 Απριλίου 2012

Add "holes" to an array - NSNull

You cannot add nil to an array.
If you need to add "holes" to an array, you must use NSNull.

 NSNull is an object that represents nil and is used specifically for this task. The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values).

[array addObject: [NSNull null]];

source:
iOS programming - the big nerd ranch guide (3rd edition)
documentation

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου