iOS UIImageView图片添加点击事件

2018-11-15  本文已影响0人  Simon_Liang

UIImage *img = [UIImage imageWithContentsOfFile:@"/Users/jinhui005/Desktop/style_img.png"];

UIImageView *imgView = [[UIImageView alloc] initWithImage:img];

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImage)];

[imgView addGestureRecognizer:tapGesture];

imgView.userInteractionEnabled = YES; 

上一篇 下一篇

猜你喜欢

热点阅读