iOS UIImageView用代码添加点击事件

时间:2021-12-10 16:05:37
image.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imagePressed:)];
[image addGestureRecognizer:tap];