Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable zoom WebView #16

Closed
Xopoko opened this issue Nov 26, 2016 · 2 comments
Closed

Disable zoom WebView #16

Xopoko opened this issue Nov 26, 2016 · 2 comments

Comments

@Xopoko
Copy link

Xopoko commented Nov 26, 2016

How to disable zoom in/out in this view?

@iwasrobbed
Copy link
Collaborator

If you're talking about the DownView web view, you should likely add this meta tag to the index.html file that gets rendered but keep in mind that this may not work in iOS 10 and above.

<meta name="viewport" content="width=device-width, user-scalable=no" />

You can find more info about disabling zoom on http://stackoverflow.com/q/4389932/308315

@mbecker
Copy link

mbecker commented Feb 2, 2017

Not the perfect solution because double tap or scrolling down and the pinching out seems to work.

The better solution for me is to add:

extension DownView: UIScrollViewDelegate {
    public func viewForZooming(in scrollView: UIScrollView) -> UIView? {
        return nil
    }
}

Set the webview's scrollview delegate in DownView.init():

self.scrollView.delegate = self

Change the viewport in index.html to:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Change the font scale in the css file to whatever you like:

-ms-text-size-adjust: 80%;
-webkit-text-size-adjust: 80%;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants