On 17 Apr '08, at 9:15 AM, Johnny Lundy wrote:
NSArray says you can change the values of elements, but not add/ subtract/replace elements.
Nope; NSArrays are completely immutable. To make any modifications you first have to make a mutable copy, and then modify that. (The same goes for NSDictionary, NSSet and NSString.) You might want to re-read the conceptual overview of Cocoa collections.
My confusion is that there is no setValue:forIndex:. There is only setValue: forKey: , but arrays do not have keys.
setValue:forKey: has nothing to do with the contents of the array — it's a generic method inherited from NSObject; it's part of Key-Value Coding, a higher-level mechanism of getting and setting properties of object. About the only key that's applicable to an NSArray is its count, and trying to set the value of that on an immutable array would raise an exception.
—Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]