iOS Question webview zoom

Semen Matusovskiy

Well-Known Member
Licensed User
At first, you can add a viewport tag to the header, something like <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> (it will work and without some of these parameters, but I prefer to specify all).

Another way is to retrieve WKWebView's scrollview.
Dim no As NativeObject = WebView1
Dim sv As NativeObject = no.GetField ("scrollView")

Using ScrollView, you can set the same parameters like in viewport tag.
sv.RunMethod ("setZoomScale:animated:", Array (1.0, False))
sv.SetField ("maximumZoomScale", 1.0)
sv.SetField ("minimumZoomScale", 1.0)
Upvote 0