• 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
Re: references to controllers in document based applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: references to controllers in document based applications


  • Subject: Re: references to controllers in document based applications
  • From: Paul Bruneau <email@hidden>
  • Date: Sun, 10 Feb 2008 00:09:14 -0500

On Feb 9, 2008, at 6:35 PM, Michael Babin wrote:

On Feb 9, 2008, at 3:46 PM, Torsten Curdt wrote:

I also have an AppController class that I need to reference from my documents. So this brought up a more general question. As the document handling is encapsulated inside the NSDocumentController - how do people usually do this? ...getting access to those instances that are created and controlled by the framework.

Kyle gave you the info about using the responder chain via nil- targeted actions, so I'll skip over that part. In addition, any object in your application can get the application controller (the application object's delegate) by using [NSApp delegate].

If I may butt in, which way is better? I have one app mostly under my belt and I started out creating outlets in my classes for my appController. I got the idea that was bad so I started doing [[[NSApp] delegate] aMethodInMyAppController]. In a view I have I even did something like (this is from memory) [[[self window] delegate] aMethodOfTheWindowController] to get from the view, to its window, to the window's controller.


But it sounds like I can just do [self aMethodOfTheWindowController] directly from my view provided that the responder chain is set up properly? I wonder if the compiler complains about the view possibly not being able to respond to the window controller's methods? I can't wait to try it out on Monday! I knew I was doing things questionably so having this thread appear is weekend gold!

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: references to controllers in document based applications
      • From: Michael Babin <email@hidden>
References: 
 >references to controllers in document based applications (From: Torsten Curdt <email@hidden>)
 >Re: references to controllers in document based applications (From: Michael Babin <email@hidden>)

  • Prev by Date: NSTableView Data Binding Problem
  • Next by Date: Re: Clicking in an attributed TextField
  • Previous by thread: Re: references to controllers in document based applications
  • Next by thread: Re: references to controllers in document based applications
  • Index(es):
    • Date
    • Thread