UITapGestureRecognizer *PressRecognizer1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
[PressRecognizer1 setNumberOfTouchesRequired:1];
[firstBtn addGestureRecognizer:PressRecognizer1];
-(void)handlePress:(UITapGestureRecognizer*)PressRecognizer {
NSLog(@"working");
if (PressRecognizer.state == UIGestureRecognizerStateBegan) {
UIButton *whichButton=(UIButton *)[PressRecognizer view];
NSLog(@"whichButton %d\n",whichButton.tag);
if (whichButton.tag == 0) {
NSLog(@"currentImageId1 %d",currentImageId1);
[delegate imageZoom:currentImageId1];
}
我创建了一个UITabelView
自定义单元格,每行有三个图像。当点击一个名为的图像hadlePress
方法时。但如果条件,我不会先进入。