views:

302

answers:

3

What is the best a quickest way to reset an NSMutableArray?

+7  A: 

-[NSMutableArray removeAllObjects] doesn't work for you?

jdelStrother
It does now...Thanks!
rson
Stupidly it appears to actually release the object... What is the point in that? Anyway I got round it by putting a [NSMutableArray retain] just before the removeAllObjects.
Joe
Joe - in that case, your code is broken. See http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/Articles/mmObjectOwnership.html
jdelStrother
+3  A: 

removeAllObjects

Kristopher Johnson
+1  A: 

removeAllObjects if assuming by 'reset', you mean you just want to empty the array.

Tom