Subclassing a NSMutableArray
Subclassing a NSMutableArray
- Subject: Subclassing a NSMutableArray
- From: Lorenzo <email@hidden>
- Date: Thu, 16 Mar 2006 16:57:10 +0100
Hi,
until yesterday I used to send a series of commands to the "only one"
selected object. Now I have just activated the multiselection so I would
like to send the same commands to all the items of the array of the objects
selected. The 20 commands are like
[item setParam:par to:theValue verbose:YES];
so I cannot use
makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject
because I won't build all the time a NSDictionary for anObject and fill it
with all the values. My code is huge and I call the methods from everywhere
for hundres times.
So I thought to subclass an NSMutableArray and create the same 20 methods
and send the calls to any item of the array.
e.g.
- (void)setParam:(int)par to:(float)newValue verbose:(BOOL)verbose
{
int i, totObjects = [self count];
for(i = 0; i < totObjects; i++){
id item = [self objectAtIndex:i];
[item setParam:par to:newValue verbose:verbose];
}
}
So now I should be able to just replace the array in the call above
[selectedObjectsArray setPos:whichPos to:theValue verbose:YES];
But subclassing an anbstarct class like NSMutableArray seems to be
impossible. Is it true?
I get this
exception: *** -count only defined for abstract class. Define
-[XYCustomArray count]!
What do you suggest?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden