# MLDPhotoManager **Repository Path**: moliysdev/MLDPhotoManager ## Basic Information - **Project Name**: MLDPhotoManager - **Description**: 一行代码呼出AlertController选择相册或者相机,极简封装. - **Primary Language**: Objective-C - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://github.com/youngwifemoliy/MLDPhotoManager - **GVP Project**: No ## Statistics - **Stars**: 18 - **Forks**: 3 - **Created**: 2017-04-25 - **Last Updated**: 2022-10-18 ## Categories & Tags **Categories**: ios-modules **Tags**: None ## README # MLDPhotoManager --- 20171013更新说明: * 优化:不再显示照片数为0的相册 * 修复:issues #1*在一个相册内选够9张,换到另一个相册,再换回来,取消之前选中项,再选时会提示数量已满* * 增加:plist里面的相册相机权限(之前忘记了😆) --- 20170628更新说明: * 更新了api增加了最大张数的参数 --- >基于@gang544043963大神的[LGPhotoBrowser](https://github.com/gang544043963/LGPhotoBrowser)项目再次封装的 ![1](http://onazihscc.bkt.clouddn.com/WechatIMG125.png )![1](http://onazihscc.bkt.clouddn.com/WechatIMG123.png )![1](http://onazihscc.bkt.clouddn.com/WechatIMG124.png ) #### 项目初衷 本身[LGPhotoBrowser](https://github.com/gang544043963/LGPhotoBrowser)已经很是完美了,完成了很多我们的需求,但是在我的项目中会多次出现AlertController让用户选择相机还是相册这种需求实例.在这个基础上想到了再次封装. #### 用法 只需要将`MLDPhotoManager`拖入项目中即可 ```obj-c [MLDPhotoManager showPhotoManager:sender withMaxImageCount:9 withCameraImage:^(UIImage *cameraImage) { NSLog(@"cameraImage==%@",cameraImage); } withAlbumArray:^(NSArray *albumArray) { NSLog(@"albumArray==%@",albumArray); }]; ``` 基于Block方便管理 #### 说明 ```obj-c + (void)showPhotoManager:(UIView *)carryView withMaxImageCount:(NSInteger)maxCount withCameraImage:(void(^)(UIImage *cameraImage))cameraImage withAlbumArray:(void(^)(NSArray *albumArray))albumArray ``` 其中`(UIView *)carryView`这个参数要说明一下. 方法是直接呼出了`UIAlertController`但是在 *iPad* 中`UIAlertController`不能自下而上的直接弹出,需要一个停靠的`View`所以需要告诉控制器是哪个`View`响应了这个`UIAlertController`. eg:你是按了一个 *Button* 想呼出`UIAlertController`那么这个 *Button* 就是 *carryView* #### 注意 [LGPhotoBrowser](https://github.com/gang544043963/LGPhotoBrowser)项目已经集成了[DACircularProgress](https://github.com/danielamitay/DACircularProgress) [SDWebImage](https://github.com/rs/SDWebImage)如果项目中有这两个库的童鞋可以删除. 位置 *LGPhotoBrowser-->Classes-->Third* 本项目应用于iOS 9+ #### 再次鸣谢 再次鸣谢@gang544043963大神的[LGPhotoBrowser](https://github.com/gang544043963/LGPhotoBrowser)项目,从这个项目中学习到了很多东西.👍👍👍 #### 在这里找到我 E-Mail: youngwifemoliy@live.cn Weibo: [@MoliySDev](http://weibo.com/moliy)