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];
网友评论