Basically, I want to have an NSMutableArray
, but only allow it to have 5 items. If I add a sixth, the oldest item in the array gets removed.
Would I be best off just subclassing NSMutableArray and checking this in addObject
then using removeObjectsInRange
or is there a better solution?