Re: Subclass of NSMutableArray isn't working
Re: Subclass of NSMutableArray isn't working
- Subject: Re: Subclass of NSMutableArray isn't working
- From: Fritz Anderson <email@hidden>
- Date: Wed, 10 Mar 2004 11:27:23 -0600
On 10 Mar 2004, at 10:44 AM, Jamie Griffin wrote:
I am open to the alternative of creating an NSObject subclass with an
internal array. However, to do this I would need to find a way of
passing messages to the array if my class does not respond to them
(kind of like a subclass does naturally...). Would a delegate be
appropriate?
Yes. In your class, implement
- methodSignatureForSelector:, so that if [super
methodSignatureForSelector:] returns nil, it returns the array member's
methodSignatureForSelector:.
- forwardInvocation:, so that you check that the array responds to the
received invocation's selector, and if it does, sends [invocation
invokeWithTarget: array].
Your class will then implement the array's methods by forwarding them
to the array. You may find that you have a lot of compiler warnings
that your class "may not respond to" the array methods -- you may want
to suppress the waarnings by declaring them in a category interface.
See the documentation for the respective methods of NSObject.
-- F
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.