Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent making new Untitled document when Mac OS X document based application start up?

I'm making a new Mac OS X application. (not an iPhone app) This is document-based application.

It shows a new "Untitled" document instance automatically when it starts up. How can I block this behavior? I wish my application show no window at start up.

like image 419
eonil Avatar asked Apr 01 '10 06:04

eonil


1 Answers

Apple Doc, Document Based application overview - FAQ:

How can I keep my application from creating an untitled document at launch?

Implementing the applicationShouldOpenUntitledFile: method to return NO in your application delegate prevents the application from opening an untitled file when launched or activated. If you do want to open an untitled file when launched, but don't want to open an untitled file when already running and activated from the dock, you can instead implement applicationShouldHandleReopen:hasVisibleWindows: to return NO

like image 76
stefanB Avatar answered Sep 19 '22 22:09

stefanB