照片多选、预览、代理回调
项目需要、自行封装,特此分享。
注意点:对于一千张以上甚至更多的图片待检测显示效果。点击所有图片All Photos、图片能否在collectionView上显示,待检测。
效果图如下:
photo.png collection.jpg single.jpghow to use
1.导入头文件
#import "ZCJImagesViewController.h"
#import "ZCJSelectImageViewController.h"
//2.遵守代理 ZCJSelectImageViewControllerDelegate
@interface ViewController ()<ZCJSelectImageViewControllerDelegate>
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
ZCJImagesViewController *imagesCtr = [[ZCJImagesViewController alloc] init];
imagesCtr.delegate = self;
UINavigationController *navigation = [[UINavigationControlleralloc]initWithRootViewController:imagesCtr];
[self presentViewController:navigation animated:YES completion:nil];
}
- (void)selectImageViewController:(id)picker didFinishPickingImageWithInfo:(NSArray<UIImage *> *)info
{
NSLog(@"%@",info);
}
网友评论