Commit 85b84708071c786f36d5b6bcb3636fe97832a800
1 parent
dc0a557f
0.3.1 版本 图片选择库整理
Showing
3 changed files
with
25 additions
and
23 deletions
CNLiveCMineModule.podspec
CNLiveCMineModule/Classes/CNCSubMine/ViewController/CNMinePersonIconController.m
| ... | ... | @@ -8,13 +8,13 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNMinePersonIconController.h" |
| 10 | 10 | #import "CNBottomSelectView.h" |
| 11 | -#import "TZImagePickerController.h" | |
| 11 | +#import <CNLiveImagePickerController/CNImagePickerManager.h> | |
| 12 | 12 | #import "RSKImageCropper.h" |
| 13 | 13 | #import "CNCSubMinePresent.h" |
| 14 | 14 | #import <CoreServices/CoreServices.h> |
| 15 | 15 | #import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h> |
| 16 | 16 | #import <CNLiveNewIMAManagerKit/IMAPlatform.h> |
| 17 | -@interface CNMinePersonIconController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate, RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource> | |
| 17 | +@interface CNMinePersonIconController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate, RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource> | |
| 18 | 18 | |
| 19 | 19 | @property (nonatomic, strong) UIImageView *iconView; |
| 20 | 20 | @property (nonatomic, strong) CNBottomSelectView *selectV; |
| ... | ... | @@ -207,7 +207,7 @@ |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | } else if (index == 1) { |
| 210 | - TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:weakSelf]; | |
| 210 | + CNTZImagePickerController *imagePickerVc = [[CNTZImagePickerController alloc] initWithMaxImagesCount:1 delegate:weakSelf]; | |
| 211 | 211 | imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; |
| 212 | 212 | imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 |
| 213 | 213 | imagePickerVc.allowPreview = NO; | ... | ... |
CNLiveCMineModule/Classes/CNOrder/View/CNUploadVoucher.m
| ... | ... | @@ -7,18 +7,20 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "CNUploadVoucher.h" |
| 10 | -#import "TZImagePickerController.h" | |
| 11 | -#import "TZImageManager.h" | |
| 10 | +//#import "TZImagePickerController.h" | |
| 11 | +//#import "TZImageManager.h" | |
| 12 | 12 | #import "LxGridViewFlowLayout.h" |
| 13 | + | |
| 13 | 14 | #import "TZTestNewCell.h" |
| 15 | + | |
| 14 | 16 | #import <AssetsLibrary/AssetsLibrary.h> |
| 15 | 17 | #import <Photos/Photos.h> |
| 16 | 18 | |
| 17 | -#import "TZLocationManager.h" | |
| 18 | -#import "CNImagePickerController.h" | |
| 19 | +//#import "TZLocationManager.h" | |
| 20 | +#import <CNLiveImagePickerController/CNImagePickerManager.h> | |
| 19 | 21 | |
| 20 | 22 | @interface CNUploadVoucher () |
| 21 | -<TZImagePickerControllerDelegate,UINavigationControllerDelegate, UIImagePickerControllerDelegate, | |
| 23 | +<UINavigationControllerDelegate, UIImagePickerControllerDelegate, | |
| 22 | 24 | UICollectionViewDataSource,UICollectionViewDelegate, |
| 23 | 25 | UIActionSheetDelegate> |
| 24 | 26 | { |
| ... | ... | @@ -173,7 +175,7 @@ UIActionSheetDelegate> |
| 173 | 175 | |
| 174 | 176 | } else { //预览照片 |
| 175 | 177 | CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.row]; |
| 176 | - [imagePickerVc configTZImagePicker]; | |
| 178 | + [imagePickerVc configCNTZImagePicker]; | |
| 177 | 179 | imagePickerVc.maxImagesCount = 9; |
| 178 | 180 | imagePickerVc.allowPickingGif = NO; |
| 179 | 181 | imagePickerVc.allowPickingOriginalPhoto = YES; |
| ... | ... | @@ -221,7 +223,7 @@ UIActionSheetDelegate> |
| 221 | 223 | #pragma mark - TZImagePickerController |
| 222 | 224 | - (void)pushTZImagePickerController { |
| 223 | 225 | CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc]initWithMaxImagesCount:9 columnNumber:4 delegate:self pushPhotoPickerVc:YES]; |
| 224 | - [imagePickerVc configTZImagePicker];//配置 | |
| 226 | + [imagePickerVc configCNTZImagePicker];//配置 | |
| 225 | 227 | #pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 |
| 226 | 228 | imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto; |
| 227 | 229 | |
| ... | ... | @@ -277,7 +279,7 @@ UIActionSheetDelegate> |
| 277 | 279 | [self takePhoto]; |
| 278 | 280 | } |
| 279 | 281 | // 拍照之前还需要检查相册权限 |
| 280 | - } else if ([TZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 | |
| 282 | + } else if ([CNTZImageManager authorizationStatus] == 2) { // 已被拒绝,没有相册权限,将无法保存拍的照片 | |
| 281 | 283 | if (iOS8Later) { |
| 282 | 284 | UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的“设置-隐私-相册“中允许访问相册" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];//设置 |
| 283 | 285 | [alert show]; |
| ... | ... | @@ -286,8 +288,8 @@ UIActionSheetDelegate> |
| 286 | 288 | // UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法访问相册" message:@"请在iPhone的""设置-隐私-相册""中允许访问相册" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil]; |
| 287 | 289 | // [alert show]; |
| 288 | 290 | // } |
| 289 | - } else if ([TZImageManager authorizationStatus] == 0) { // 未请求过相册权限 | |
| 290 | - [[TZImageManager manager] requestAuthorizationWithCompletion:^{ | |
| 291 | + } else if ([CNTZImageManager authorizationStatus] == 0) { // 未请求过相册权限 | |
| 292 | + [[CNTZImageManager manager] requestAuthorizationWithCompletion:^{ | |
| 291 | 293 | [self takePhoto]; |
| 292 | 294 | }]; |
| 293 | 295 | } else { |
| ... | ... | @@ -323,23 +325,23 @@ UIActionSheetDelegate> |
| 323 | 325 | [picker dismissViewControllerAnimated:YES completion:nil]; |
| 324 | 326 | NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; |
| 325 | 327 | if ([type isEqualToString:@"public.image"]) { |
| 326 | - TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | |
| 328 | + CNTZImagePickerController *tzImagePickerVc = [[CNTZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | |
| 327 | 329 | tzImagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; |
| 328 | 330 | tzImagePickerVc.sortAscendingByModificationDate = YES; |
| 329 | 331 | [tzImagePickerVc showProgressHUD]; |
| 330 | 332 | UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; |
| 331 | 333 | |
| 332 | 334 | // save photo and get asset / 保存图片,获取到asset |
| 333 | - [[TZImageManager manager] savePhotoWithImage:image location:nil completion:^(NSError *error){ | |
| 335 | + [[CNTZImageManager manager] savePhotoWithImage:image location:nil completion:^(NSError *error){ | |
| 334 | 336 | [tzImagePickerVc hideProgressHUD]; |
| 335 | 337 | if (error) { |
| 336 | 338 | [tzImagePickerVc hideProgressHUD]; |
| 337 | 339 | NSLog(@"图片保存失败 %@",error); |
| 338 | 340 | } else { |
| 339 | - [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(TZAlbumModel *model) { | |
| 340 | - [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) { | |
| 341 | + [[CNTZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(CNTZAlbumModel *model) { | |
| 342 | + [[CNTZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<CNTZAssetModel *> *models) { | |
| 341 | 343 | [tzImagePickerVc hideProgressHUD]; |
| 342 | - TZAssetModel *assetModel = [models firstObject]; | |
| 344 | + CNTZAssetModel *assetModel = [models firstObject]; | |
| 343 | 345 | if (tzImagePickerVc.sortAscendingByModificationDate) { |
| 344 | 346 | assetModel = [models lastObject]; |
| 345 | 347 | } |
| ... | ... | @@ -394,11 +396,11 @@ UIActionSheetDelegate> |
| 394 | 396 | } |
| 395 | 397 | |
| 396 | 398 | #pragma mark - TZImagePickerControllerDelegate |
| 397 | -- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker { | |
| 399 | +- (void)tz_imagePickerControllerDidCancel:(CNTZImagePickerController *)picker { | |
| 398 | 400 | // NSLog(@"cancel"); |
| 399 | 401 | } |
| 400 | 402 | |
| 401 | -- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos { | |
| 403 | +- (void)imagePickerController:(CNTZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos { | |
| 402 | 404 | _selectedPhotos = [NSMutableArray arrayWithArray:photos]; |
| 403 | 405 | _selectedAssets = [NSMutableArray arrayWithArray:assets]; |
| 404 | 406 | _isSelectOriginalPhoto = isSelectOriginalPhoto; |
| ... | ... | @@ -480,10 +482,10 @@ UIActionSheetDelegate> |
| 480 | 482 | _imagePickerVc.navigationBar.tintColor = self.viewController.navigationController.navigationBar.tintColor; |
| 481 | 483 | UIBarButtonItem *tzBarItem, *BarItem; |
| 482 | 484 | if (iOS9Later) { |
| 483 | - tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; | |
| 485 | + tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[CNTZImagePickerController class]]]; | |
| 484 | 486 | BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; |
| 485 | 487 | } else { |
| 486 | - tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; | |
| 488 | + tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[CNTZImagePickerController class], nil]; | |
| 487 | 489 | BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil]; |
| 488 | 490 | } |
| 489 | 491 | NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; | ... | ... |