UIScrollView,滑动,缩放 [英] UIScrollView, sliding, zooming

查看:32
本文介绍了UIScrollView,滑动,缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它有一个 uiscrollview,而它又具有两个 uiimageviews.通过使内容大小是宽度的两倍,滚动视图在两个图像视图之间滑动时效果很好.像这样

I have an app which has a uiscrollview, which in turn has two uiimageviews. The scrollview works fine in sliding between both imageviews, by making the content size twice the width. like so

   [self.scrollView setContentSize:CGSizeMake(self.scrollView.frame.size.width * 2, self.scrollView.frame.size.height)];

现在客户希望用户能够放大这两个图像中的任何图像.他不希望放大所选图片的另一个模态视图,而是在他希望发生的同一个 uiscrollview 上.这是可行的吗?还是一个好主意?

Now the client wants the user to be able to zoom into any image in those two images. He does not want another modal view with the selected picture zoomed in, but rather on the same uiscrollview he wants this to happen. Is this doable? or a good Idea?

我遇到的问题是,当我实现缩放逻辑(实现委托

The problem I am having is that when I implement the zooming logic ( implementing the delegate

  UIScrollViewDelegate

我设置

 self.scrollView.zoomScale

我最终调用了这个方法

 - (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView {
   return [self getCurrentVisibleImage];
 }

随着这种情况的发生,我最终得到了 UIscrollview,在缩放回图像的正常大小后,滚动视图根本不会向左或向右滑动?

And with that happening, I end up with the UIscrollview that after zooming back to the normal size of the image, the scrollview simply doesn't slide left or right?

感谢任何帮助.

推荐答案

答案很简单,我是在操纵 contentsize 而没有正确设置它.解决了它.

Answer was simple, I was manipulating contentsize and not setting it properly. that fixed it.

这篇关于UIScrollView,滑动,缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆