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