• 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
Responder Chain Patching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Responder Chain Patching


  • Subject: Responder Chain Patching
  • From: Keith Duncan <email@hidden>
  • Date: Sun, 13 Jul 2008 16:48:45 +0100

I'm working with NSViewController to create a workflow of controllers. I'm trying to patch the controller into the responder chain so that I can implement action methods in the specific controllers and in the window controller.

I'm using the following code in an attempt to create a responder chain like this:

ButtonView -> ContainerView -> MyViewController -> WindowContentView - > Window -> WindowController -> etc...

- (void)setViewController:(TLViewController *)controller {
if (_viewController != controller) {
[_viewController release];
_viewController = [controller retain];
_viewController.controller = self;

[self setActiveContentView:[_viewController view]];

// Patch into the responder chain
// This must be done after the view has a superview
[_viewController setNextResponder:[[_viewController view] nextResponder]];
[[_viewController view] setNextResponder:_viewController];
}
}


However, it isn't working. The view controller doesn't receive any messages so I've clearly overlooked something. I've confirmed in GDB that all the -nextResponders are set correctly; I just can't figure it out. I've also confirmed using -targetForAction:to:from: that the view controller isn't returned as the target. Implementing the methods in the window controller work and it's returned as the target as expected.

Keith Duncan
email@hidden, 33software.com

_______________________________________________

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


  • Prev by Date: [NSDate +dateWithNaturalLanguageString] question
  • Next by Date: Re: [NSDate +dateWithNaturalLanguageString] question
  • Previous by thread: Re: [NSDate +dateWithNaturalLanguageString] question
  • Next by thread: Re: Responder Chain Patching
  • Index(es):
    • Date
    • Thread