• 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
Reloading a window from NIB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reloading a window from NIB


  • Subject: Reloading a window from NIB
  • From: Sergey Shapovalov <email@hidden>
  • Date: Fri, 2 Mar 2007 12:57:14 +0300

Hello Cocoa-dev!

(I've already tried to send this message to the list yesterday, but it looks like it
didn't appear in the digest. So this is attempt number 2...)


I am new to the list, so sorry if my question has been already discussed. However,
a brief search in the archive found nothing relevant for me.


I am developing a one-window Cocoa application. This means that the user can close
the main window, then open it again, but he/she can't open 2 instances of the main
window. The behavior of the "New" command is redefined to just reset the state of
all controls in the main window to the original state.


To implement this behavior of the "New" command, I'd like to be able to reload the
window in its original state as it is stored in the NIB. My question is as simple as:
how can I do it?


Should I set the "Release when closed" flag for the window? But if I do so, how
shall I create it again on "New" command? Now Cocoa creates it for me automatically
when the application launches. Will I have to re-initialize window controller by
calling initWithWindowNibName manually? And generally speaking, is this a
good idea or just a way to nowhere?


Another approach I can see is using NSDocumentController. I think it can help
just because in document-based applications, every new document window
instance appears clean just like it is stored in NIB. But NSDocumentController
is designed for document-based applications, which is not my case of application
with just one main window. Can I employ it for my needs though?


And well, if there's more than one way to make it work, which is better and why?
Any advice will be appreciated!


Best regards,
Sergey.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: drawRect problem
  • Next by Date: Re: NSTabView-like view and NSWindowController
  • Previous by thread: Re: drawRect problem
  • Next by thread: Re: Reloading a window from NIB
  • Index(es):
    • Date
    • Thread