I'm new to developing and an amateur to say the least.
I exported a html from Tumult Hype, inserted it in Xcode 9.3, everything works fne on my iPad, except the whole scene is zoomable/pinchable and it should NOT be zoomable.
I used the following with ObjectiveC, is there something similar with swift [self.webview setScalesPageToFit:NO];
I have tried everything I can think of. Any help would be appreciated. Thanks ahead of time.
Here is it is:
import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let webView = WKWebView()
let htmlPath = Bundle.main.path(forResource: "Zimt_09_03", ofType: "html")
let folderPath = Bundle.main.bundlePath
let baseUrl = URL(fileURLWithPath: folderPath, isDirectory: true)
do {
let htmlString = try NSString(contentsOfFile: htmlPath!, encoding: String.Encoding.utf8.rawValue)
webView.loadHTMLString(htmlString as String, baseURL: baseUrl)
} catch {
}
webView.navigationDelegate = self
view = webView
webView.scrollView.isScrollEnabled = false;
webView.scrollView.bounces = false;
// the following commands do not work for me
/* func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) {
scrollView.pinchGestureRecognizer?.isEnabled = false
scrollView.panGestureRecognizer.isEnabled = false
}
*/
/*func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) {
scrollView.pinchGestureRecognizer?.isEnabled = false
}
*/
/*func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return nil
}
*/
}
}