identifying the main app controller

  • Hi All,

    I have read everything I thought might help with no luck.

    I have a main controller instantiated via MainMenu.nib, and a window
    controller used to open another window after closing the first. Once
    I have left control of the main app controller and entered the window
    controller's code, how can I reference the original controller? For
    document apps, I found this:

    Every nib file has an owner (FilesOwner). A typical
    NSWindowController nib file's owner is a NSWindowController object.
    What you should do is subclass NSWindowController, make the
    Properties.nib's file owner an instance of your subclass by selecting
    the file's owner in InterfaceBuilder, pressing Command-5 and
    selecting your subclass in the list. Make sure every user action in
    Properties.nib objects sends its message to the nib file's owner,
    i.e. to your NSWindowController subclass object. Then edit the action
    methods definitions in Xcode or ProjectBuilder. You can always access
    the appropriate NSDocument subclass from its NSWindowController by
    sending [self document].

    I would think there must be an equally easy way to access the main
    app controller.


  • > I would think there must be an equally easy way to access the main
    > app controller.

      Are you referring to the application's delegate?

      [NSApp delegate] ...

      Otherwise, you can create an outlet to it like anything else. In
    your second controller (or any controllers), create an outlet:

    IBOutlet id        appControllerOrWhateverOtherController;

      ... and connect it. This is all detailed in the introductory

previous month january 2008 next month
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today