UIScrollView, sliding, zooming

回眸只為那壹抹淺笑 提交于 2019-12-24 22:33:20

问题


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)];

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

the moment I set the value of

 self.scrollView.zoomScale

I end up calling this method

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

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?

Any help is appreciated.


回答1:


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



来源:https://stackoverflow.com/questions/18476944/uiscrollview-sliding-zooming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!