Forum Archive

WebView not allowing me to scroll to the bottom right corner

uj_jonas

I have an iPad 4 with 720p resolution. When I run this code, the webview prevents me from scrolling to the right.

import ui

main = ui.View(frame=(0, 0, ui.get_screen_size()[0], ui.get_screen_size()[1]))
wv_container = ui.View(frame=(0, 0, 1920, 1080))
wv = ui.WebView(frame=wv_container.frame)
wv.load_url('http://www.example.com')

wv_container.add_subview(wv)
main.add_subview(wv_container)
main.present('fullscreen')
ccc
import ui
main = ui.ScrollView(frame=(0, 0, *ui.get_screen_size()))
main.content_size = (1920, 1080)
wv = ui.WebView(frame=(0, 0, *main.content_size))
wv.load_url('http://www.example.com')
main.add_subview(wv)
main.present()
uj_jonas

@ccc said:

import ui
main = ui.ScrollView(frame=(0, 0, ui.get_screen_size()))
main.content_size = (1920, 1080)
wv = ui.WebView(frame=(0, 0,
main.content_size))
wv.load_url('http://www.example.com')
main.add_subview(wv)
main.present()

Can I do this and still have the wv_container? I kinda need my webview inside a separate view :/

Cethric

@uj_jonas instead of making main a ui.ScrollView in your code make wv_container a ui.ScrollView.

JonB

why do you want the webview to be larger than your screen? you should fit the wv to the screen... if the web contents is wider than the screen, the webview will let you scroll inside it.

putting a webview in a scrollview is asking for confusion.

uj_jonas

@Cethric thanks. Didn't even think of that