David Le
David Le

Reputation: 11

- (void)scrollWheel:(NSEvent)theEvent does not work

I wrote an app in cocoa with a window document with a PDFView inside. I am trying to intercept scrollWheel: events in the PDFView but for some reason that method is never passed to the PDFView. Instead the view scrolls down or up depending on your perspective.

scrollWheel: is part of the responder chain so I expect the method to be called but it doesn't.

Does anyone know why?

Upvotes: 1

Views: 1513

Answers (1)

Joshua Nozzi
Joshua Nozzi

Reputation: 61228

If your PDFView is inside a scroll view, the scroll view is likely eating the -scrollWheel: event. If not, then you need to make sure your PDFView subclass accepts first responder:

-(BOOL)acceptsFirstResponder
{
    return YES;
}

If that doesn't work, then you'll need to provide more detail about what you're trying to accomplish and how you're trying to accomplish it (ie, post your code).

Upvotes: 1

Related Questions