iOS开发——给ImageView添加点击事件

 

 

 

给ImageView添加点击事件

 

   1:  cell.pictureView.userInteractionEnabled = YES;
   2:      UITapGestureRecognizer *gr = [[UITapGestureRecognizer alloc]initWithTarget:cell action:@selector(displayPicture:)];
   3:      gr.numberOfTapsRequired = 1;
   4:      gr.numberOfTouchesRequired = 1;
   5:   [cell.pictureView addGestureRecognizer:gr ];

 

   1:  -(void)displayPicture:(UITapGestureRecognizer*)gr{
   2:      NSLog(@"%s----%@",__func__,gr);
   3:      [self.delegate displayPic:self.pictureView.image];
   4:  }
posted @ 2015-04-26 16:40  有奈了  阅读(1194)  评论(0编辑  收藏  举报