Forum Archive

Access to WebView's ScrollView

mikael

Hello

I have a need to disable scrolling for a WebView, but even if UIWebView has a scrollView attribute to provide access for doing this, the attribute has not been exposed in Python.

Pending a Pythonista update, any ideas how to either get access to the underlying ScrollView of an already existing WebView, or how to disable scrolling in some other manner?

Thanks,
Mikael

omz

This should work:

from objc_util import *
import ui

webview = ui.WebView()

scrollview = ObjCInstance(webview).subviews()[0].scrollView()
scrollview.setScrollEnabled_(False)

webview.load_url('http://stackoverflow.com')
webview.present()
mikael

Thanks! Both for the to-the-point reply - and the 20-minute response time.