Adding a fullscreen window from another project and customising


I have limited experience of Xcode and would like to add a window that resizes to fullscreen to my Cocoa application. I came across the following webpage which explains how to design just the kind of window I am looking for and has a downloadable project which just consists of the resizable window:

At the end of the article it states that “The whole code is one method in the sample app ” an easy copy and paste into any application” but I am still not sure exactly what I need to copy and paste to get the window in my new project.

Also I am trying to work out how to add the following features:

  1. set the colour of the background to black
  2. set the window to go fullscreen when it is double-clicked
  3. add a close button to the window so that it can be closed (it will not be the main window of my application).

Any help to get this working would be appreciated.



1 is easy: use the window method setBackgroundColor:

3 is easier: select the window and check Close in the Attributes panel of Interface Builder.

2 is harder – the zoom button is meant to do that. You will probably need to override keyDown: and parse the resulting NSEvent.