UIImageView响应点击事件
2013-07-20 00:06
302 查看
定义Image的对象
UIImageView *imgView =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0,320,100)];
imgView.backgroundColor = [UIColor redColor];//因为没有设置image属性,为了显示出图片覆盖区域
imgView.userInteractionEnabled=YES;
UITapGestureRecognizer *singleTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onClickImage)];
[imgView addGestureRecognizer:singleTap];
[singleTap release];
响应方法
-(void)onClickImage{
NSLog(@"图片被点击!");
}
UIImageView *imgView =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0,320,100)];
imgView.backgroundColor = [UIColor redColor];//因为没有设置image属性,为了显示出图片覆盖区域
imgView.userInteractionEnabled=YES;
UITapGestureRecognizer *singleTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onClickImage)];
[imgView addGestureRecognizer:singleTap];
[singleTap release];
响应方法
-(void)onClickImage{
NSLog(@"图片被点击!");
}
相关文章推荐
- UIImageView响应点击事件
- UIImageView响应点击事件
- iphone 让一个UIImageView响应点击事件
- 让一个UIImageView响应点击事件
- UIImageView上添加Button不能响应点击事件
- 让一个UIImageView响应点击事件
- ios UIImageView响应点击事件
- UIImageView响应点击事件
- UIImageView上添加Button不能响应点击事件
- UI15-UIImageView响应点击事件
- UIImageView响应点击事件
- UIImageView响应点击事件
- 怎么让一个UIImageView响应点击事件呢
- UIImageView上添加Button不能响应点击事件
- iOS开发-UIImageView响应点击事件
- UIImageView上添加Button不能响应点击事件
- 为UIImageView添加响应点击事件(Swift)
- UIImageView响应点击事件
- 怎么让一个UIImageView响应点击事件呢
- 【Xamarin 】MonoTouch - UIImageView响应点击事件