Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have create an app in Xcode.

In my apps I require a functionality that has several images in uiscroll view.

I cannot zoom images in scroll view. How i do it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
223 views
Welcome To Ask or Share your Answers For Others

1 Answer

put your image view inside scroll view, and make user interaction as well as multiple touch enable in each, now

provide following setting to your scroll view:

//Pinch Zoom Stuff
imageScrollView.maximumZoomScale = 4.0;
imageScrollView.minimumZoomScale = 1.0;
imageScrollView.clipsToBounds = YES;
imageScrollView.delegate = self;
imageScrollView.scrollEnabled = NO;

Then implement Following methods:

- (void)scrollViewDidZoom:(UIScrollView *)scrollView 
{
if (scrollView.zoomScale!=1.0) 
{
    // Not zoomed, let the scroll view scroll
    imageScrollView.scrollEnabled = YES;

}
else 
{
    // Zooming, disable scrolling
    imageScrollView.scrollEnabled = NO;
}
}

- (UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView
{

return imageView;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...