Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable scrolling of WKWebView in NSScrollView

I'd like to disable scrolling of my WKWebView that's inside a NSScrollView on macOS in Swift.

I found a way to disable scroll inside the WKWebView with css, tho the WKWebView still stops the NSScrollView from scrolling.

Dose anyone know how to do this?

like image 478
Heestand XYZ Avatar asked May 14 '17 08:05

Heestand XYZ


1 Answers

Subclass WKWebView and implement the following method:

- (void)scrollWheel:(NSEvent *)event {
    // pass web view scroll events to the next responder. comment
    // this line out if you just want to disable scrolling 
    // altogether.
    //
    [[self nextResponder] scrollWheel:event];
}
like image 185
lobianco Avatar answered Sep 28 '22 00:09

lobianco