CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Oct 2017 |
Maintained by bingozb.
pod 'DKPhotosPicker'
DKPhotosPicker
文件夹整个拖到你的项目中####使用方法
1. 在需要使用的控制器里引入头文件
#import "DKPhotoPickerViewController.h"
2. 遵守代理协议
<DKPhotoPickerViewControllerDelegate>
3. 实例化一个多图片选择控制器,并设置相关参数
DKPhotoPickerViewController *photoPickerVc = [[DKPhotoPickerViewController alloc] init];
photoPickerVc.photoPickerVcDelegate = self; // 设置代理
photoPickerVc.maxImageNumber = 10; // 最多选择张数,默认为3
photoPickerVc.minImageNumber = 3; // 最少选择张数,默认为1
// Bundle中已默认提供 选中、未选中、退出 三张图片,可以自定义
// photoPickerVc.selectedImage = [UIImage imageNamed:@"选中"];
// photoPickerVc.unSelectedImage = [UIImage imageNamed:@"未选中"];
4. 在需要展示多图片选择控制器的地方调用show方法
[photoPickerVc show];
5. 实现代理方法
/** (request) 选取了图片 */
- (void)photoPickerViewController:(DKPhotoPickerViewController *)photoPickerViewController didSelectedPhotos:(NSArray *)photos
{
// 选择的图片数组
// self.photoArr = photos;
NSLog(@"%@",photos);
// ...
}
/** (optional) 选取图片数量达到下限 */
- (void)photoPickerViewControllerDidSelectedMinImages:(DKPhotoPickerViewController *)photoPickerViewController
{
// 选取图片数量达到下限
// 如果需要用到下限张数,可以访问photoPickerViewController.minImageNumber;
// ...
}
/** (optional) 选取图片数量达到上限 */
- (void)photoPickerViewControllerDidSelectedMaxImages:(DKPhotoPickerViewController *)photoPickerViewController
{
// 选取图片数量达到上限
// 如果需要用到上限张数,可以访问photoPickerViewController.maxImageNumber;
// ...
}
/** (optional) 无权限访问系统相册 */
- (void)photoPickerViewControllerAccessDenied:(DKPhotoPickerViewController *)photoPickerViewController
{
// 没有权限访问系统相册的提醒
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"拒绝访问" message:@"请到设置中允许应用访问相册" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alertView show];
}