CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

XDPicLibrary 1.0.6

XDPicLibrary 1.0.6

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2017

Maintained by Xiexingda.



  • By
  • xiexingda

一个自定义图片选择器

使用方法:

1 引入头文件

#import "XDPicLibrary.h"

2 在点击事件里面进行跳转

  • (void)buttonSelected {

XDPicLibrary *root = [[XDPicLibrary alloc]initBackInfo:^(NSMutableArray *assets) {

/*

assets 为图片资源组 不是直接的Image,如果用Image 的话需要 转换,转换方法:

imageAsset = assets[index];

//获取大图资源

ALAssetRepresentation *presentation = [imageAsset defaultRepresentation];

//大图

CGImageRef original = [presentation fullResolutionImage];

//image

UIImage *originalImage = [UIImage imageWithCGImage:original];

//获取缩略图

CGImageRef thumbnail = [itemAsset thumbnail];

//转为image

UIImage *image = [UIImage imageWithCGImage:thumbnail];

*/

}];

//设置一次性选择的最大张数

root.maxNumber = 1;

//设置图片

// [root setImage:nil selectedImage:[UIImage imageNamed:nil]];

//设置选中按钮的选中前 & 选中后的颜色

// [root setColor:[UIColor clearColor] selectedColor:[UIColor blueColor]];

//设置选中按钮的边框颜色

// [root setMarkBorderColor:[UIColor whiteColor]];

/*

由于笔者比较懒,懒得再去弄navBar的东西,当前只能push过去,如果想present过去的话,需要自行实现

XDPicLibrary的navBar,并把左右按钮的点击事件对应起来就OK了

*/

[self.navigationController pushViewController:root animated:YES];

}