触摸中心,图像向右移动,同时开始放大 UIScrollView
我正在基于 git 上找到的 Scrolling Madness 代码实现一个滚动视图,并使用三个 uiimageview 将其更新为像杂志一样无限图像滚动:
- 第一个 uiimageview:最后一页
- 第二个 uiimageview:首页
- 第三个 uiimageview:第二页
代码使用scrollRectToVisible 将第二个 uiimageview 置于屏幕中心,但是当我开始用手指在中心缩放它时,图像向右移动,在屏幕和左侧留下一部分空白处的尺寸。缩放工作正常,但图像的行为不正确。
我检查了 Scrolling Madness 项目并复制了相同的行为。第二张图像向右移动,第三张图像离开屏幕。
关于如何纠正这个问题有什么想法吗?我尝试修改滚动视图的 contentoffset 和其他选项,但没有成功。
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 contentoffset and other options of the scrollview but no success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在网上看到另一个缩放项目后,我找到了另一个对我有用的解决方案。在 Scrolling Madness 项目中,在
setZoomingMode
函数中,将滚动视图的内容大小设置为与要缩放的 uiview 相同的大小。另外,就我而言,我修改了 uiview 框架的原点以使其在屏幕上可见。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.我发现一个非常有用的方法可以解决此页面上的问题: http:// idevzilla.com/2010/10/04/uiscrollview-and-zoom/
I found a very useful method that solved the problem on this page: http://idevzilla.com/2010/10/04/uiscrollview-and-zoom/