A titled window can display an arbitrary title or one derived from a filename. The setTitle:
method puts an arbitrary string on the title bar. The setTitleWithRepresentedFilename:
method formats a filename in the title bar in a readable format and associates the window with that file. You can set the associated file without changing the title using setRepresentedFilename:
. You can use the association between the window and the file in any way you see fit. One convenience offered by the NSWindow
class is marking the file as being edited, so that you can prompt the user to save it on closing the window. The method for marking this is setDocumentEdited:
. When the window closes, its delegate can check it with isDocumentEdited
to see whether the document needs to be saved.
© 2002, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)