UIView通过手势(Gesture-UITapGestureRecognizer)添加点击事件, 类似于UIButton的效果.
示例:
UIImageView *iKnowIcon = [CYResource loadImageView:@"free-question-once-more-i-know.png"];
iKnowIcon.top = questionIcon.top + scaleWidthWith320(200);
iKnowIcon.centerX = self.width / 2;
[self addSubview:iKnowIcon];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)];
iKnowIcon.userInteractionEnabled = YES;
[iKnowIcon addGestureRecognizer:tap];
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/caroline_wendy/article/details/46791621