iOS-TZImagePickerController获取图片视频

TZImagePickerControllerDemo

项目介绍

TZImagePickerControllerDemo

Podfile新增行

'TZImagePickerController'```
1
2
使用之前导入头文件 ```#import <TZImagePickerController.h>

使用说明

选照片

1
2
3
4
5
6
7
8
9
10
11
12
//MaxImagesCount 可以选着的最大条目数
TZImagePickerController *imagePicker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
// 是否显示可选原图按钮
imagePicker.allowPickingOriginalPhoto = NO;
// 是否允许显示视频
imagePicker.allowPickingVideo = NO;
// 是否允许显示图片
imagePicker.allowPickingImage = YES;
// 这是一个navigation 只能present
[self presentViewController:imagePicker animated:YES completion:nil];

选择照片的回调

1
2
3
4
5
6
7
// 选择照片的回调
-(void)imagePickerController:(TZImagePickerController *)picker
didFinishPickingPhotos:(NSArray<UIImage *> *)photos
sourceAssets:(NSArray *)assets
isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto{
}

选视频

1
2
3
4
5
6
7
8
9
10
11
12
//MaxImagesCount 可以选着的最大条目数
TZImagePickerController *imagePicker = [[TZImagePickerController alloc] initWithMaxImagesCount:2 delegate:self];
// 是否显示可选原图按钮
imagePicker.allowPickingOriginalPhoto = NO;
// 是否允许显示视频
imagePicker.allowPickingVideo = YES;
// 是否允许显示图片
imagePicker.allowPickingImage = NO;
// 这是一个navigation 只能present
[self presentViewController:imagePicker animated:YES completion:nil];

选择视频的回调

1
2
3
4
5
6
// 选择视频的回调
-(void)imagePickerController:(TZImagePickerController *)picker
didFinishPickingVideo:(UIImage *)coverImage
sourceAssets:(PHAsset *)asset{
}

相关链接