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

Cannot zoom out #45

Closed
piotrros opened this issue Jan 28, 2019 · 3 comments
Closed

Cannot zoom out #45

piotrros opened this issue Jan 28, 2019 · 3 comments

Comments

@piotrros
Copy link

Hi, your library seems to be fine, but when I zoom in the image too much I no longer can zoom it out. I mean, I cannot pinch-zoom. The workaround is to double tap.

My view hierarchy is simple:

zrzut ekranu 2019-01-28 o 19 54 22

and here are constraints:

zrzut ekranu 2019-01-28 o 19 54 28

So, I have a view pinned to the sides and top with 1:1 aspect ratio and ImageScrollView inside pinned to all edges (no margin).

Code is also very simple:

override func viewDidLoad() {
        super.viewDidLoad()
        
        imageScrollView.setup()
        
        if let myImage = UIImage(named: "test.png") {
            imageScrollView.display(image: myImage)
        }
}

What could be wrong?

Pod is added like this:

pod 'ImageScrollView', :git => 'https://github.com/huynguyencong/ImageScrollView.git'

because

pod 'ImageScrollView'

just didn't work for me. It was using some old version of the library, where I couldn't even find setup() method.

@piotrros
Copy link
Author

If I just put "ImageScrollView" directly to the root view and pin it to all the edges it works flawlessly. I guess the issue is caused by the "PageView". But it's just an ordinary UIView, nothing more. Strange thing is I've also tried few other libraries like this and they all worked in root view, but when moved to "PageView" none of them worked (just didn't respond to any touches), but this almost works except of zooming out (but only if you zoom in too much).

@piotrros
Copy link
Author

After some debugging I've figured out that non-full height causes this issue. So it doesn't matter if it's a child of some view (like "PageView") or direct child of root view, but rather if it spans for the whole height or not.

@piotrros
Copy link
Author

Hmm, looks like somehow I've resolved this issue. I have a pageView which ImageScrollView inside pinned to all sides. First of all I set the right aspect ratio constraint and AFTER that I call imageScrollView.display(image). Then, it works, strange..

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

1 participant