自己在工作閑暇之余寫了仿微信朋友圈的圖片瀏覽放大的框架 LLPhotoBrowser
希望能幫助大家快速開發 有什么問題可留言本人第一時間解答問題
有問題可留言 有喜歡的可動動小指頭點贊
GitHub地址:https://github.com/liuniuliuniu/LLPhotoBrowser
效果圖
LLPhotoBrowserAnim.gif
使用方法
(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
// 1 初始化
LLPhotoBrowser *photoBrowser = [[LLPhotoBrowser alloc]init];
// 2 設置代理
photoBrowser.delegate = self;
// 3 設置當前圖片
photoBrowser.currentImageIndex = indexPath.item;
// 4 設置圖片的個數
photoBrowser.imageCount = self.photoArr.count;
// 5 設置圖片的容器
photoBrowser.sourceImagesContainerView = self.collectionView;
// 6 展示
[photoBrowser show];
}
// 代理方法 返回圖片URL
- (NSURL *)photoBrowser:(LLPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index{
NSURL *url = [NSURL URLWithString:self.photoArr[index]];
return url;
}
// 代理方法返回縮略圖
- (UIImage *)photoBrowser:(LLPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index{
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0];
LLPhotoCell *cell = (LLPhotoCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
return cell.bigImgV.image;
}
此外 :里邊長按圖片進行保存圖片的LLActionSheetView 可進行自定義