-(void)setImageView:(UIImageView *) imageView{ UITapGestureRecognizer *singleTapGR, *doubleTapGR,*mutilTapGR; singleTapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectImage:)]; singleTapGR.delegate = self; doubleTapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showImage:)]; doubleTapGR.numberOfTapsRequired = 2; doubleTapGR.delegate = self; mutilTapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(log)]; mutilTapGR.numberOfTapsRequired = 3; mutilTapGR.delegate = self; //当你需要使用单击时请求双击事件失败. [singleTapGR requireGestureRecognizerToFail:doubleTapGR]; [doubleTapGR requireGestureRecognizerToFail:mutilTapGR]; [imageView addGestureRecognizer:singleTapGR]; [imageView addGestureRecognizer:doubleTapGR]; [imageView addGestureRecognizer:mutilTapGR]; [singleTapGR release]; [doubleTapGR release]; [mutilTapGR release]; }
ios中控件同时响应单击和双击事件以及多击事件
最新推荐文章于 2019-11-05 17:28:58 发布