init-ing something one did not alloc
init-ing something one did not alloc
- Subject: init-ing something one did not alloc
- From: Alex Rice <email@hidden>
- Date: Sun, 25 Nov 2001 14:33:34 -0700
Short version of the question: "init-ing something I did not alloc" --
just how bad is it?
Long version of the question:
I've read that this is a Bad Thing(r) to be doing. But I've encountered
a situation where it really seems like the best thing to be doing.
What's a better way?
I've got a NSDateFormatter that's an IBOutlet. In my
windowControllerDidLoadNib method I've got some code which sets up the
date formatter like so:
if([[NSUserDefaults standardUserDefaults]
objectForKey:NSShortTimeDateFormatString])
{
// this is an outlet, I did not alloc it
[aDateFormatter initWithDateFormat:
[[NSUserDefaults standardUserDefaults]
objectForKey:NSShortTimeDateFormatString]
allowNaturalLanguage:YES];
}
It does what I need it to do without programmatically creating the
NSDateFormatter. Is this really bad? It seemingly runs OK. Would I be
better off deleting the NSDateFormatter from my nib and creating it
programmatically?
TIA
Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/