给UIimageView添加点击事件

 9、为UIImageView添加单击事件:

imageView.userInteractionEnabled = YES;

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];

[imageView addGestureRecognizer:singleTap];

本文出自 “yangjun” 博客,谢绝转载!

你可能感兴趣的:(ios)