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

前端 未结 14 1765
野性不改
野性不改 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 13:56

    Subclass the UIScrollView an in m file add

    #pragma mark -
    #pragma mark doubleTouch
    
    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        UITouch *touch = [touches anyObject];
        NSUInteger tapCount = [touch tapCount];
        switch (tapCount) {
            case 2:
            {
                if(self.zoomScale <1.0){
                    [self setZoomScale:1.0 animated:YES];
                }else{
                    [self setZoomScale:0.1 animated:YES];
                }
    
                break;
            }
            default:
                break;
        }
    }
    

提交回复
热议问题