SDPhotoBrowser 非常简单易用的图片浏览

郎长卿
2023-12-01

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; [imageView addGestureRecognizer:singleTap]; UIView *singleTapView = [singleTap view]; singleTapView.tag = i; [_picPathStringsArray addObject:url]; - (void)handleSingleTap:(UIGestureRecognizer *)gestureRecognizer { debugMethod(); NSLog(@"%d",[gestureRecognizer view].tag); SDPhotoBrowser *browser = [[SDPhotoBrowser alloc] init]; browser.currentImageIndex = [gestureRecognizer view].tag; browser.sourceImagesContainerView = _scrollView; browser.imageCount = self.picPathStringsArray.count; browser.delegate = self; [browser show]; } #pragma mark - SDPhotoBrowserDelegate - (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index { NSString *imageName = self.picPathStringsArray[index]; NSURL *url = [NSURL URLWithString:imageName]; return url; } - (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index { UIImageView *imageView = _temp[index]; return imageView.image; }


 类似资料: