UITapGestureRecognizer是没有tag属性,但他有UIView的属性,我们可以通过给UIView添加tag属性,从而标记UITapGestureRecognizer,从而去识别多个不同的手势。
UITapGestureRecognizer *singleTap =[[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(whenClickImage:)];
[_firstImage addGestureRecognizer:singleTap];
UIView *singleTapView = [singleTap view];
singleTapView.tag=0;
-(void)whenClickImage:(id)sender{
UITapGestureRecognizer *singleTap = (UITapGestureRecognizer*)sender;
NSLog(@"%d",[singleTapview].tag]);
}
********将来的你一定会感激现在拼命的自己,愿每一个努力的人都能有收获!******
我的传送门: 个人博客 CSDN github
微信公众号:搞事情的程序猿
网友评论