Watch 1 Star 1 Fork 1

卟败灬筱龙 / TZImagePickerControllerDemoObjective-C

Join us
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
TZImagePickerControllerDemo spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

TZImagePickerControllerDemo

项目介绍

TZImagePickerControllerDemo

Podfile新增行

pod 'TZImagePickerController'

使用之前导入头文件

#import <TZImagePickerController.h>
#import "MovEncodeToMpegTool.h"

使用说明

选照片

    //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];
	

选择照片的回调

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

选视频

    //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];
    

选择视频的回调

// 选择视频的回调
-(void)imagePickerController:(TZImagePickerController *)picker
       didFinishPickingVideo:(UIImage *)coverImage
                sourceAssets:(PHAsset *)asset{
     NSLog(@"--------- 视频编码 ----------- 开始 ----------");
    [MovEncodeToMpegTool convertMovToMp4FromPHAsset:asset
                      andAVAssetExportPresetQuality:ExportPresetMediumQuality
                  andMovEncodeToMpegToolResultBlock:^(NSURL *mp4FileUrl, NSData *mp4Data, NSError *error) {
        NSLog(@"--------- 视频编码 ----------- 结束 ----------\n{\n  %@,\n   %ld,\n  %@\n}",mp4FileUrl,mp4Data.length,error.localizedDescription);
    }];
}
	

Comments ( 0 )

Sign in for post a comment

Objective-C
1
https://gitee.com/LiynXu/TZImagePickerControllerDemo.git
git@gitee.com:LiynXu/TZImagePickerControllerDemo.git
LiynXu
TZImagePickerControllerDemo
TZImagePickerControllerDemo
master

Help Search

182353 aa51c838 1899542 205747 347fc4a1 1899542