I'm experimenting with the turbolinks-ios adapter for turbolinks 5.
In order to have some view, for example a welcome view right at the beginning, feel even more native, I'd like to deactivate some UIWebView
features like zooming or selecting text.
How can I disable these features on the UIWebView
instance?
Demo Application
Turbolinks for iOS has a demo application that may serve as an example context if this makes it easier to answer the question.
The demo app can be found here: https://github.com/turbolinks/turbolinks-ios/tree/master/TurbolinksDemo
Dis not work: Setting maximumZoomScale
The documentation for UIScrollView
's maximumZoomScale
reads:
maximumZoomScale: A floating-point value that specifies the maximum scale factor that can be applied to the scroll view's content. This value determines how large the content can be scaled. It must be greater than the minimum zoom scale for zooming to be enabled. The default value is 1.0.
Thus, in the view controller, I tried to set the property:
// DemoViewController.swift
class DemoViewController: Turbolinks.VisitableViewController {
override func viewDidLoad() {
super.viewDidLoad()
visitableView.webView?.scrollView.maximumZoomScale = 1.0
visitableView.webView?.scrollView.minimumZoomScale = 1.0
}
// ...
}
But unfortunately, this has no effect.
The zooming can be disabled on the server side by setting
user-scalable=no
on the viewport meta tag:As this stackoverflow answer suggested:
There has been some discussion that this would no longer be possible in iOS 10. But according to the release nots of iOS10 beta 6, this is now opt-in: