Enhance the TZImagePickerController library, supports to preview photo by UIImage or NSURL and preview video by NSURL.
对TZImagePickerController库的增强,支持用UIImage、NSURL预览照片和用NSURL预览视频。
pod 'TZImagePreviewController'
将TZImagePickerController文件夹拽入项目中,导入头文件:#import "TZImagePreviewController.h"
TZImagePreviewController *previewVc = [[TZImagePreviewController alloc] initWithPhotos:self.selectedPhotos currentIndex:indexPath.row tzImagePickerVc:[self createTZImagePickerController]];
[previewVc setBackButtonClickBlock:^(BOOL isSelectOriginalPhoto) {
NSLog(@"back isSelectOriginalPhoto:%d", isSelectOriginalPhoto);
}];
[previewVc setSetImageWithURLBlock:^(NSURL *URL, UIImageView *imageView) {
[imageView sd_setImageWithURL:URL];
}];
[previewVc setDoneButtonClickBlock:^(NSArray *photos, BOOL isSelectOriginalPhoto) {
self.selectedPhotos = [NSMutableArray arrayWithArray:photos];
NSLog(@"done isSelectOriginalPhoto:%d photos.count:%zd", isSelectOriginalPhoto, photos.count);
[self.collectionView reloadData];
}];
[self presentViewController:previewVc animated:YES completion:nil];
iOS 8 or later. Requires ARC
iOS8及以上系统可使用. ARC环境.
There is Demo inside, Please refer to Demo for usage.
内有Demo,请参考Demo进行使用。