Re: Responder chain query
Re: Responder chain query
On 8 Oct 2013, at 17:40, Seth Willits <email@hidden> wrote:
> On Oct 8, 2013, at 8:40 AM, email@hidden wrote:
>
>> My intention is track the status of my top level view controllers and insert/remove these as required in the responder chain between the window and the window controller (rather than between views in the chain).
>> That way I figure that actions and validation methods will always hit the view controller regardless of whether an NSView based first responder exists.
>>
>> Is this the best approach?
>
> Yup. Been doing it for years. There was some code written by Cathy Shive and Jonathan Dann to help with that called XSViewController. Don't know where the original source is now, but basically it managed a tree of view controllers by adding a parent-child relationship between view controllers, with the tree attached to the XSWindowController. VCs could easily be attached and removed from the tree and it would reconnect the responder chain correctly.
I think this might be a version of what you are referring to:
https://github.com/catshive/KTUIKit/blob/master/Framework/Controllers/KTViewController.m
My implementation is simpler, using a couple of category methods on NSWindow to patch in my view controllers.
However the tree implementation might be useful in future.
Thanks
J
_______________________________________________
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