UIImageView添加点击事件和获取手势的uiview

UIImageView添加点击事件

image.userInteractionEnabled = YES;//it is very improtant!!!
[image addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headportraitClicked:)]];

获取调用手势的uiview

(void)btnClicked:(UITapGestureRecognizer *)sender{
    UIButton *btn = (UIButton *)sender.view;
}

你可能感兴趣的:(UIImageView添加点击事件和获取手势的uiview)