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
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
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.
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