{"id":13696822,"url":"https://github.com/gang544043963/LGPhotoBrowser","last_synced_at":"2025-05-03T17:32:28.120Z","repository":{"id":45725347,"uuid":"45519329","full_name":"gang544043963/LGPhotoBrowser","owner":"gang544043963","description":"照片浏览器，相册选择器，自定义照相机（支持单拍、连拍）","archived":false,"fork":false,"pushed_at":"2019-11-06T06:44:18.000Z","size":13476,"stargazers_count":544,"open_issues_count":9,"forks_count":113,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-20T21:48:40.257Z","etag":null,"topics":["broswer","image","photo","picker"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gang544043963.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-04T06:18:06.000Z","updated_at":"2025-03-28T08:40:17.000Z","dependencies_parsed_at":"2022-09-22T14:25:40.427Z","dependency_job_id":null,"html_url":"https://github.com/gang544043963/LGPhotoBrowser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gang544043963%2FLGPhotoBrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gang544043963%2FLGPhotoBrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gang544043963%2FLGPhotoBrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gang544043963%2FLGPhotoBrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gang544043963","download_url":"https://codeload.github.com/gang544043963/LGPhotoBrowser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252226860,"owners_count":21714885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["broswer","image","photo","picker"],"created_at":"2024-08-02T18:00:47.953Z","updated_at":"2025-05-03T17:32:27.316Z","avatar_url":"https://github.com/gang544043963.png","language":"Objective-C","funding_links":[],"categories":["UI Components"],"sub_categories":[],"readme":"# LGPhotoBrowser  [![Travis](https://img.shields.io/travis/rust-lang/rust.svg)]()   [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/GIKICoder/GDataBase/master/LICENSE)\u0026nbsp;\n\n# 前言\n - 此框架经过实际项目锤炼，使用过程中改善了众多bug，在稳定性、流畅性以及内存消耗方面做了大量优化。但难免还有缺陷，希望同仁们在使用过程中发现并指正，并提issue！\n \n - 注意：如果照相机不需要连拍功能，建议采用系统相机，经测试，自定义相机的体验和内存消耗均劣于系统相机。\n \n - 相册优化方法：[iOS中自定义相册功能性能优化](http://blog.csdn.net/gang544043963/article/details/49329261)\n \n - 如果对您有帮助，记得star，动力源自鼓励\n \n\n# 简介\n- 此框架包含三个模块：图片浏览器，相册选择器，自定义照相机（支持单拍、连拍）； \n\n- 界面仿照微信的样式； \n\n- 加载本地照片速度快； \n\n- 图片浏览器采用后台预加载手段，完全消除大图浏览的卡顿现象； \n\n- 具备相册已选组别记忆功能； \n\n- 支持夜间模式；\n\n# 1.图片浏览器\n\u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/browser.gif?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e\n\n\n# 2.相册选择器\n\n\u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/picker.gif?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e \u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/browser1.gif?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e\n\n\n# 3.自定义相机\n\n\u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/IMG_2653.PNG?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e  \u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/IMG_2652.PNG?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e \u003cimg src=\"https://github.com/gang544043963/MyDataSource/blob/master/IMG_2651.PNG?raw=true\" alt=\"CXLSlideList Screenshot\" width=\"200\" height=\"360\"/\u003e\n\n# 添加到工程\n第一步：拷贝Class文件文件夹和Images文件夹到工程.\n\n第二步：'#import \"LGPhoto.h\"'\n\n备注：\n\n- 自定义相册通常会根据需求做调整，所以不支持cocoaPods \n\n- 用到的第三方：\n  \n  |图片下载|等待框            |\n  |:------:|:--------------------:|\n  |SDWebImage  |DACircularProgressView|\n\n  如果你的项目中已经存在这两个框架，请手动删除Third文件夹中对应的框架。\n  \n# 初始化\n\n初始化相册选择器，里面包括大图浏览\n```\n/**\n *  初始化相册选择器\n */\n- (void)presentPhotoPickerViewControllerWithStyle:(LGShowImageType)style {\n    LGPhotoPickerViewController *pickerVc = [[LGPhotoPickerViewController alloc] initWithShowType:style];\n    pickerVc.status = PickerViewShowStatusCameraRoll;\n    pickerVc.maxCount = 9;   // 最多能选9张图片\n    pickerVc.delegate = self;\n    self.showType = style;\n    [pickerVc showPickerVc:self];\n}\n```\n如果单独使用图片浏览器，也很简单：初始化+实现数据源方法\n```\n/**\n *  初始化图片浏览器\n */\n- (void)pushPhotoBroswerWithStyle:(LGShowImageType)style{\n    LGPhotoPickerBrowserViewController *BroswerVC = [[LGPhotoPickerBrowserViewController alloc] init];\n    BroswerVC.delegate = self;\n    BroswerVC.dataSource = self;\n    BroswerVC.showType = style;\n    self.showType = style;\n    [self presentViewController:BroswerVC animated:YES completion:nil];\n}\n```\n```\n#pragma mark - LGPhotoPickerBrowserViewControllerDataSource\n\n- (NSInteger)photoBrowser:(LGPhotoPickerBrowserViewController *)photoBrowser numberOfItemsInSection:(NSUInteger)section{if (self.showType == LGShowImageTypeImageBroswer) {\n        return self.LGPhotoPickerBrowserPhotoArray.count;\n    } else if (self.showType == LGShowImageTypeImageURL) {\n        return self.LGPhotoPickerBrowserURLArray.count;\n    } else {\n        NSLog(@\"非法数据源\");\n        return 0;\n    }\n}\n//在这里，需要把图片包装成LGPhotoPickerBrowserPhoto对象，然后return即可。\n- (id\u003cLGPhotoPickerBrowserPhoto\u003e)photoBrowser:(LGPhotoPickerBrowserViewController *)pickerBrowser photoAtIndexPath:(NSIndexPath *)indexPath{\n    if (self.showType == LGShowImageTypeImageBroswer) {\n        return [self.LGPhotoPickerBrowserPhotoArray objectAtIndex:indexPath.item];\n    } else if (self.showType == LGShowImageTypeImageURL) {\n        return [self.LGPhotoPickerBrowserURLArray objectAtIndex:indexPath.item];\n    } else {\n        NSLog(@\"非法数据源\");\n        return nil;\n    }\n}\n\n```\n详见ViewController.m，注释很清楚\n\n# 环境支持\niOS7及更高\n\n# LICENSE\nLGPhotoBrowser is released under the MIT license. See LICENSE for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgang544043963%2FLGPhotoBrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgang544043963%2FLGPhotoBrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgang544043963%2FLGPhotoBrowser/lists"}