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。