• 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
Re: Automatically Call a Function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically Call a Function


  • Subject: Re: Automatically Call a Function
  • From: Marcel Weiher <email@hidden>
  • Date: Sun, 15 Jun 2008 11:31:15 -0700


On Jun 15, 2008, at 10:09 , Philip Lee Bridson wrote:

Firstly I need a function to automatically run from a class used in MainMenu.nib when the main.m calls NSApplicationMain();

The NSApplication object provides this facility:

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html


--- snip ---
-applicationDidFinishLaunching:
Sent by the default notification center after the application has been launched and initialized but before it has received its first event.


- snip ---

You'll need to create that delegate object and hook it up to your application object.

Also, I cannot figure out why when I initialize a window from a nib or from a file before the call to NSApplicationMain() the program crashes due to a memory leak.

Programs tend not to crash from memory leaks unless the leak is large +long enough that you run out of memory.


I have tried to put the function in awakeFromNib but then the window wont close itself from that function.

awakeFromNib is not the appropriate place for this.

Marcel

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Automatically Call a Function
      • From: Philip Lee Bridson <email@hidden>
References: 
 >Automatically Call a Function (From: Philip Lee Bridson <email@hidden>)

  • Prev by Date: Re: Automatically Call a Function
  • Next by Date: iPhone SDK build of default application fails
  • Previous by thread: Re: Automatically Call a Function
  • Next by thread: Re: Automatically Call a Function
  • Index(es):
    • Date
    • Thread