UIScrollView 中的图像在缩放之前移出屏幕
我正在开发一个照片库 iPhone 应用程序。
方法的灵感来自于 github 上的 ScrollingMadness 代码。 我有一个滚动视图,在分页模式下保存所有图像视图。 当用户使用张开手势缩放图像时,我会删除除当前图像视图之外的所有图像视图,并将内容偏移设置为 0,0(显然)。
在模拟器上一切都很完美,但在设备上我面临这个疯狂的问题。 当用户张开手指缩放图像时,图像会离开屏幕,而当张开触摸事件结束时,图像会返回屏幕。
缩放图像一次后,如果我进一步缩放它 - 它不会给我带来错误的体验。 这使我得出一个结论,即需要应用补丁,从滚动视图中删除其他图像视图并保留正在缩放的图像视图。
无法弄清楚我应该如何让它像 iPhone 的照片应用程序一样工作。 神奇的照片应用程序!
任何能够指出让这个东西启动并运行的方向的人 - 将是我现在需要的所有帮助!
I am working on a photo gallery iPhone app.
Approach is fairly inspired from the ScrollingMadness code available on github.
I have a scroll view which holds all my image views when in paging mode. When user zooms an image using pinch out gesture, I remove all the image views but the current one - and set the content offset to 0,0 (obviously).
Everything works perfect on simulator but on device I face this crazy issue.
When a user pinch out to zoom an image, it goes off screen and when the pinch out touch event ends, it comes back to the screen.
After zooming the image once, if I zoom it further - it does not give me the buggy experience. This leads me to a conclusion that patch needs to be applied where I am removing the other image views from the scroll view and holding the one which is being zoomed.
Not able to figure out how I should make it to work like the iPhone's Photo app. The - magical - Photos app!
Anyone who can point to a direction to get this thing up and running - would be all the help I need right now!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,因为当您缩放时,您会将图片有效地移动到 (0,0) 第一页,您会期望当用户捏住任何不是第一页的页面时,图像将必须移动到 0,0,因此您正在体验你的形象的移动。 缩放一次后,图像已经处于 0,0 位置,因此后续缩放工作正常。 您是否发现在第一页上缩放可以实现您想要的行为,而只有其他页面有此问题? 如果是这样,解决方法可能不是将缩放图片移动到 (0,0),而只是将其保留在原来的位置,并为所有其他页面提供一些虚拟视图,这样就不会占用其他图片的内存。 希望这可以帮助
Well, since when you zoom you are moving your picture to (0,0) effectivly the first page, you would expect when the user pinches any page thats not the first one, the image will have to move to 0,0 and therefore you are expiriencing your image moving. After you zoomed once, the image is already at 0,0 so subsequent zooms work fine. Are you finding that zooming on the very first page gives you the behavior you want and only other pages have this issue? If so a fix might be not to move the zooming picture to (0,0) but just keep it where it is and have some dummy view for all your other pages so you dont take up memory from the other pictures. Hope this helps