美文网首页
ios添加UIimageView添加事件

ios添加UIimageView添加事件

作者: frola_ | 来源:发表于2017-09-12 09:29 被阅读0次
UIImageView *ViewLabel = [[UIImageView alloc]init];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imageTap:)];
 [_ViewLabel addGestureRecognizer:tap];
[_ViewLabel setUserInteractionEnabled:YES];

-(void)imageTap:(UIGestureRecognizer *)tap{
  XLPhotoBrowser *browser = [XLPhotoBrowser showPhotoBrowserWithImages:@[_commentmodel.images.filePath] currentImageIndex:0];
    browser.delegate = self;
    browser.datasource = self;    
}

注意一定要设置image view的setUserInteractionEnabled=YES

[_ViewLabel setUserInteractionEnabled:YES];

相关文章

网友评论

      本文标题:ios添加UIimageView添加事件

      本文链接:https://www.haomeiwen.com/subject/sbmfsxtx.html