When developing OS X apps in Cocoa, WebView does not have over-scroll elasticity (i.e., the bouncy scrolling that Safari has on OS X). How do you enable it?
After much putzing, I figured out the answer. The key is to get a handle of the scroll view that WebView creates (but does not publicly expose). Here is how to do it:
- (void)awakeFromNib
{
[self setMainFrameURL:@"http://www.stackoverflow.com"];
NSScrollView * scrollView = (NSScrollView *)([[[self mainFrame] frameView] subviews][0]);
[scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic];
[scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic];
}
Note that this needs to be done whenever the frame's URL is set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With