WJPhotoPicker 1.1.9

WJPhotoPicker 1.1.9

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年12月

Nius 维护。



  • 作者
  • zwj
  • 一个简单的照片选择器,您可以从相册导出视频文件到文件路径,自动适配 iOS7 和 iOS8 自动(ALAsset 和 PHAsset),兼容 iPhone 和 iPad,横屏适配。
  • 一款使用简单的可选照片相册,自动适配 iOS7 和 iOS7,支持从相册中导出视频文件,同时兼容 iPhone、iPad,横屏适配。

内容

  • 入门
  • [系统 [iOS7+]]

安装

  • Podfile 添加:pod 'WJPhotoPicker'
  • 导入主头文件:#import "WJPhotoPickerController.h"

用法

下载 zip 文件并查看示例以获取详细信息。

示例(同步和异步获取图片或视频)

    // Synchronous get image
    UIImage *originalImage = [picker synchronousGetImage:photoAsset thumb:NO];
    UIImage *thumbImage = [picker synchronousGetImage:photoAsset thumb:YES];
    NSLog(@"originalImage:%@, thumbImage:%@", originalImage, thumbImage);

    // Asynchronous get image
    [picker asynchronousGetImage:photoAsset thumb:NO completeCb:^(UIImage *image) {
        NSLog(@"originalImage:%@", image);
    }];
    [picker asynchronousGetImage:photoAsset thumb:YES completeCb:^(UIImage *image) {
        NSLog(@"thumbImage:%@", image);
    }];
    [picker asynchronousGetImage:photoAsset completeCb:^(UIImage *originalImage, UIImage *thumbImage) {
        NSLog(@"originalImage:%@,thumbImage:%@", originalImage, thumbImage);
    }];


    // Asynchronous get image
    if (photoAsset.isVideo) {
        NSString *doctumentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        NSDateFormatter *formater = [[NSDateFormatter alloc] init];
        [formater setDateFormat:@"yyyy-MM-dd-HH:mm:ss"];
        NSString *filename = [NSString stringWithFormat:@"output-%@.mp4", [formater stringFromDate:[NSDate date]]];
        NSString *resultPath = [doctumentsPath stringByAppendingPathComponent:filename];

        NSLog(@"----start----exportVideoFile");
        [picker exportVideoFileFromAsset:photoAsset filePath:resultPath completeCb:^(NSString *errStr) {
            NSLog(@"resultPath:%@", resultPath);
            NSLog(@"----end----exportVideoFile");
        }];
    }

许可证

WJPhotoBrowser 采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE。