-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
加入用NSOperationQueue控制获取原图并发数降低内存的示例;发布3.1.9版本
- Loading branch information
1 parent
0737c61
commit c5e87ef
Showing
14 changed files
with
128 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "TZImagePickerController" | ||
s.version = "3.1.8" | ||
s.version = "3.1.9" | ||
s.summary = "A clone of UIImagePickerController, support picking multiple photos、original photo and video" | ||
s.homepage = "https://github.com/banchichen/TZImagePickerController" | ||
s.license = "MIT" | ||
s.author = { "banchichen" => "[email protected]" } | ||
s.platform = :ios | ||
s.ios.deployment_target = "8.0" | ||
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "3.1.8" } | ||
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "3.1.9" } | ||
s.requires_arc = true | ||
s.resources = "TZImagePickerController/TZImagePickerController/*.{png,bundle}" | ||
s.source_files = "TZImagePickerController/TZImagePickerController/*.{h,m}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// TZImageUploadOperation.h | ||
// TZImagePickerController | ||
// | ||
// Created by 谭真 on 2019/1/14. | ||
// Copyright © 2019 谭真. All rights reserved. | ||
// | ||
|
||
#import "TZImageRequestOperation.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TZImageUploadOperation : TZImageRequestOperation | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// | ||
// TZImageUploadOperation.m | ||
// TZImagePickerController | ||
// | ||
// Created by 谭真 on 2019/1/14. | ||
// Copyright © 2019 谭真. All rights reserved. | ||
// | ||
|
||
#import "TZImageUploadOperation.h" | ||
#import "TZImageManager.h" | ||
|
||
@implementation TZImageUploadOperation | ||
|
||
- (void)start { | ||
NSLog(@"TZImageUploadOperation start"); | ||
self.executing = YES; | ||
dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
#pragma mark - 获取&上传大图 | ||
/* | ||
[[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
if (!isDegraded) { | ||
if (self.completedBlock) { | ||
self.completedBlock(photo, info, isDegraded); | ||
} | ||
// 在这里上传图片(代码略),图片上传完毕后调用[self done] | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
[self done]; | ||
}); | ||
} | ||
}); | ||
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
if (self.progressBlock) { | ||
self.progressBlock(progress, error, stop, info); | ||
} | ||
}); | ||
} networkAccessAllowed:YES]; | ||
*/ | ||
|
||
#pragma mark - 获取&上传原图 | ||
[[TZImageManager manager] getOriginalPhotoWithAsset:self.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
if (self.progressBlock) { | ||
self.progressBlock(progress, error, stop, info); | ||
} | ||
}); | ||
} newCompletion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
if (!isDegraded) { | ||
if (self.completedBlock) { | ||
self.completedBlock(photo, info, isDegraded); | ||
} | ||
// 在这里上传图片(代码略),图片上传完毕后调用[self done] | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
[self done]; | ||
}); | ||
} | ||
}); | ||
}]; | ||
}); | ||
} | ||
|
||
- (void)done { | ||
[super done]; | ||
// NSLog(@"TZImageUploadOperation done"); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters