Re: creating instance using Class variable

2008-08-20 Thread Eliza Block
No error! I just assumed the thing I made it up out of thin air wasn't going to work. Sorry about that, and thanks for setting me straight. -Eliza On Aug 20, 2008, at 8:36 PM, Charles Steinman wrote: --- On Wed, 8/20/08, Eliza Block <[EMAIL PROTECTED]> wrote: In short, I

Re: creating instance using Class variable

2008-08-20 Thread Eliza Block
Doesn't work how? I believe that's exactly how it's supposed to work. Hmm, you're right, it does work! I think I thought it didn't work because I just made it up without being able to find documentation. Glad the obvious thing was right. Sorry for the non-question! -Eliza

creating instance using Class variable

2008-08-20 Thread Eliza Block
Hello, Does anyone know how to use a variable of type Class to create an instance of an object? I'm writing a method that needs to create an instance of one of two classes, to be determined at run-time. I want to pass in a Class variable, and have the method use it to create the instance.

Re: NSCalendarDate to be deprecated

2008-08-18 Thread Eliza Block
You could do this: int dayOfYearForDate(NSDate *_date) { NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIndentifier:NSGregorianCalendar]]; int day = [calendar ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:_date]; return day; } I've never benchm