Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C WKWebView does not expose scrollView as per Class documentation

Documentation shows scrollView property but cannot access in code.

I get this error:

.../MasterViewController.m:106:20: Property 'scrollView' not found on object of type 'WKWebView *'

Any ideas?

This is for OS X not iOS; sorry about the tag before.

the .h file-

#import <Cocoa/Cocoa.h>
@import WebKit;
#import <WebKit/WebFrameLoadDelegate.h>

@interface MasterViewController : NSViewController

@property (strong) WKWebView *buildLog;

the .m file code-

self.buildLog.scrollView setContentOffset:100 animated:YES];
...l/MasterViewController.m:126:20: Property 'scrollView' not found on object of type 'WKWebView *'
like image 207
uott2 Avatar asked Jan 23 '26 19:01

uott2


1 Answers

The scrollView property is only part of the iOS version of WKWebView.

On OS X this is simply not available. It may be more an internal implementation detail there. You can probably find the NSScrollView by walking the WKWebView child views, but this is a bit of a grey area that may break at one point.

like image 166
Stefan Arentz Avatar answered Jan 26 '26 10:01

Stefan Arentz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!