• 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
Deallocation in Cocoa [greenhorn]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deallocation in Cocoa [greenhorn]


  • Subject: Deallocation in Cocoa [greenhorn]
  • From: Maksymilian Wojakowski <email@hidden>
  • Date: Mon, 21 Oct 2002 13:43:30 +0200

In nearly all tutorials introducing to Cocoa programming a new controller
class (myControler as sublcass of NSObject) is created and instantiated in
the MainMenu nib file.

So I created such controller class in my application. In the dealloc method
I put statment:

NSLog(@"myController dealloc");

The problem is, the dealloc method is not executed, when the application
quits. As a workaround I made myContoller class the delegate of the
application and in method (not mentioned in tutorials):

- (void)applicationWillTerminate:(NSNotification *)aNotification

I put statement:

[self release];

As the result, the dealloc method is launched when the app quits. Is it the
proper way to deallocate the main Controller?

--
Maksymilian Wojakowski mailto:email@hidden
Stettin - Poland - Central Europe
Visit my homepage: <http://homepage.mac.com/maxwoj/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Deallocation in Cocoa [greenhorn]
      • From: Ondra Cada <email@hidden>
    • Re: Deallocation in Cocoa [greenhorn]
      • From: David Remahl <email@hidden>
  • Prev by Date: Re: BSD events on NSRunLoop?
  • Next by Date: Re: check spelling as you type?
  • Previous by thread: Re: openDocument
  • Next by thread: Re: Deallocation in Cocoa [greenhorn]
  • Index(es):
    • Date
    • Thread