• 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
init-ing something one did not alloc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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/


  • Prev by Date: Re: NSCalendarDate from plist
  • Next by Date: Casting (was: NSCalendarDate from plist)
  • Previous by thread: Re: NSCalendarDate from plist
  • Next by thread: Controller knowing about an event
  • Index(es):
    • Date
    • Thread