Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BadWolf13

macrumors 6502
Original poster
Dec 17, 2009
271
0
I'm working on a class that I think would benefit from a convenience method, the same way that NSNumber, NSString and NSArray have for creating the object. Can't figure out how. The only thing I can find from a google search is someone suggesting that you call the init method with an autorelease. Like so:

Code:
+ stringWithFoo: (Foo *) aFoo
{
     return [[[self alloc] initWithFoo: aFoo] autorelease];
}

Is this really the best way to do it?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.