• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: initializers in Categories?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: initializers in Categories?
      • From: "I. Savant" <email@hidden>
    • Re: initializers in Categories?
      • From: "A.M." <email@hidden>
References: 
 >initializers in Categories? (From: Rob Ross <email@hidden>)
 >Re: initializers in Categories? (From: "A.M." <email@hidden>)

  • Prev by Date: NSEvent -keyCode decoder ring?
  • Next by Date: Re: NSImage scaling and ugliness
  • Previous by thread: Re: initializers in Categories?
  • Next by thread: Re: initializers in Categories?
  • Index(es):
    • Date
    • Thread