1

I have a small osx cocoa app that brings up an IKPictureTaker at start up, I would like for my application to quit after this picture taker is closed. I read that I need to add this code to my NSWindowController class but I have no idea how to access this class (it shows up no where in my class list in XCode):`

-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
    return YES;
}

2 Answers 2

5

You need to create a custom object that implements the NSApplicationDelegate protocol and implement the applicationShouldTerminateAfterLastWindowClosed method there.

If you already have an application delegate (you more than likely do), just add it there.

1

You have to add this method to your application delegate, whatever object that is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.