In my app i manage the responder chain on 10.8 and 10.9 to insert the 
NSViewController into the responder chain.
The view controllers are inserted just below the NSWindowController so that 
designated view controllers can respond to actions coming up the chain from any 
source.
ie: the NSViewController for any view will NOT be the view’s next responder - 
it will be higher up in the chain.

On 10.10 the view controller is automatically assigned to be the view’s next 
responder.
I want to override this behaviour to not assign the controller as the view’s 
next responder. 
I thought this would be trivial but once the NSView nextResponder has been set 
to the controller the view seems reluctant to have its next responder changed.
The next responder remains set to the view controller;

On 10.10
The following works when linked against the 10.9 SDK but fails when linked 
again the 10.10 SDK.

@interface TestViewController : NSViewController

@end

@implementation TestViewController

- (void)setView:(NSView *)view
{
    NSResponder *controlleNextResponder = self.nextResponder; // a window, the 
view is already in a nib
    NSResponder *viewNextResponder = view.nextResponder;
    
    NSLog(@"Before : %@ (== %@)", view.nextResponder, viewNextResponder);
    
    NSView *interimResponder = [NSView new];
    view.nextResponder = interimResponder;
    
    NSLog(@"Interim : %@ (== %@)", view.nextResponder, interimResponder);
    
    [super setView:view];
    
    self,view.nextResponder = viewNextResponder;
    self.nextResponder = controlleNextResponder;
    
    NSLog(@"After : %@", view.nextResponder);
    
    NSAssert(self.view.nextResponder == viewNextResponder, @"next responder is 
not restored");
}
@end

Jonathan













_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to