开发者

Touches on the center, image moves to the right while start zooming in a UIScrollView

开发者 https://www.devze.com 2023-02-01 21:58 出处:网络
I am implementing a scrollview based on the code of Scrolling Madness found on git and I update it for an infinite image scrolling like a magazzine using three uiimageviews:

I am implementing a scrollview based on the code of Scrolling Madness found on git and I update it for an infinite image scrolling like a magazzine using three uiimageviews:

- 1st uiimageview: last page

- 2nd uiimageview: first page

- 3rd uiimageview: second page

The code uses the scrollRectToVisible to center in the screen the second uiimageview but when I start zooming it with the fingers on the center, the image moves to the right, leaving a part on screen and the left size on blank. The zoom works fine and everything but the behavior of the image isn't the correct.

I checked the Scrolling Madness project and I replicated the same behavior. The second image moves to the right, and the third one goes off screen.

Any ideas of how to correct this? I have tried to modify the con开发者_JAVA百科tentoffset and other options of the scrollview but no success.


I found another solution that worked for me after seeing another zoom project on the web. In the Scrolling Madness project, in the setZoomingMode function, set your scrollview's content size the same as your uiview that will be zoomed. Also, in my case, I modified the uiview's frame's origin to make it visible on the screen.


I found a very useful method that solved the problem on this page: http://idevzilla.com/2010/10/04/uiscrollview-and-zoom/

0

精彩评论

暂无评论...
验证码 换一张
取 消