How to Zoom In/Out Photo on double Tap in the iPhone WWDC 2010 - 104 PhotoScroller

前端 未结 14 1739
野性不改
野性不改 2020-12-12 13:28

I am going through the Sample code of iPhone WWDC 2010 - 104 PhotoScroller App. It\'s working great with my project related images (PDF Page Images)

but I am struggl

14条回答
  •  一整个雨季
    2020-12-12 14:12

    Previous answer could be simpler with BlocksKit, like below.

    #import "BlocksKit.h"
    ...
    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithHandler:^(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location) {
        if(scrollView.zoomScale != 1.0){
            [scrollView setZoomScale:1.0 animated:YES];
        }else{
            [scrollView setZoomScale:2.0 animated:YES];
        }
    }];
    [doubleTap setNumberOfTapsRequired:2];
    [scrollView addGestureRecognizer:doubleTap];
    

提交回复
热议问题