Re: initializers in Categories?
Re: initializers in Categories?
- Subject: Re: initializers in Categories?
- From: Rob Ross <email@hidden>
- Date: Thu, 13 Jul 2006 12:54:10 -0700
On Jul 13, 2006, at 12:33 PM, A.M. wrote:
On Thu, July 13, 2006 3:07 pm, Rob Ross wrote:
Can a category declare a new initializer for an object?
ie,
@interface Foo (MyCategory)
- (id) initWithSomeNewArgumentList:(Bar *)bar :(Baz *)baz;
@end
Yes. You can essentially repoint arbitrary methods with a category,
but
that is almost certainly not what you want. What is it that you
wish to
accomplish?
-M
I wasn't talking about overriding an existing -init method (although
that's another good question - should you?), I was talking about
*adding* new initializers via a Category.
At this point, all I'm trying to accomplish is learn all the ways
that Categories can be used ;)
They're a new concept for me, so I'm just trying to see where the
boundaries are.
The only thing I can think of at the moment is perhaps you have a
class with a lot of ivars and accessors, and you want to use a group
of them in some part of your code, and rather then having to make a
lot of [... setXXX] calls, create a convenience initializer that will
initialize the set of ivars you care about in one call.
Rob Ross, Lead Software Engineer
E! Networks
---------------------------------------------------
"Beware of he who would deny you access to information, for in his
heart he dreams himself your master." -- Commissioner Pravin Lal
_______________________________________________
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