Skip to content

Instantly share code, notes, and snippets.

@yuxiangq
Created November 3, 2014 14:04
Show Gist options
  • Save yuxiangq/b56b55a42585a8a18d0f to your computer and use it in GitHub Desktop.
Save yuxiangq/b56b55a42585a8a18d0f to your computer and use it in GitHub Desktop.
给UIImageView添加UITapGestureRecognizer示例
-(void)initUIImageView{
UIImageView imageView = [[UIImageView alloc] init];
imageView.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)]
[imageView addGestureRecognizer:tapGestureRecognizer];
}
-(void)tapImageView:(UITapGestureRecognizer*)sender{
//doSomething
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment