Commit 328d1fc6 authored by yuzheng.tz's avatar yuzheng.tz

消灭一些block相关警告

parent 78bd70f6
...@@ -446,7 +446,7 @@ ...@@ -446,7 +446,7 @@
900E65741C2BB8D5003D9A9E /* Project object */ = { 900E65741C2BB8D5003D9A9E /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0720; LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "谭真"; ORGANIZATIONNAME = "谭真";
TargetAttributes = { TargetAttributes = {
900E657B1C2BB8D5003D9A9E = { 900E657B1C2BB8D5003D9A9E = {
...@@ -647,17 +647,28 @@ ...@@ -647,17 +647,28 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
...@@ -690,17 +701,28 @@ ...@@ -690,17 +701,28 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
...@@ -833,7 +855,7 @@ ...@@ -833,7 +855,7 @@
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
...@@ -873,7 +895,7 @@ ...@@ -873,7 +895,7 @@
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0900" LastUpgradeVersion = "0930"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
self.representedAssetIdentifier = [[TZImageManager manager] getAssetIdentifier:model.asset]; self.representedAssetIdentifier = [[TZImageManager manager] getAssetIdentifier:model.asset];
} }
int32_t imageRequestID = [[TZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.tz_width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { int32_t imageRequestID = [[TZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.tz_width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (_progressView) { if (self->_progressView) {
self.progressView.hidden = YES; self.progressView.hidden = YES;
self.imageView.alpha = 1.0; self.imageView.alpha = 1.0;
} }
...@@ -132,11 +132,11 @@ ...@@ -132,11 +132,11 @@
- (void)fetchBigImage { - (void)fetchBigImage {
_bigImageRequestID = [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { _bigImageRequestID = [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (_progressView) { if (self->_progressView) {
[self hideProgressView]; [self hideProgressView];
} }
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
if (_model.isSelected) { if (self->_model.isSelected) {
progress = progress > 0.02 ? progress : 0.02;; progress = progress > 0.02 ? progress : 0.02;;
self.progressView.progress = progress; self.progressView.progress = progress;
self.progressView.hidden = NO; self.progressView.hidden = NO;
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
_result = result; _result = result;
if (needFetchAssets) { if (needFetchAssets) {
[[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) {
_models = models; self->_models = models;
if (_selectedModels) { if (self->_selectedModels) {
[self checkSelectedModels]; [self checkSelectedModels];
} }
}]; }];
......
...@@ -540,7 +540,7 @@ static dispatch_once_t onceToken; ...@@ -540,7 +540,7 @@ static dispatch_once_t onceToken;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(thumbnailImage,nil,YES); if (completion) completion(thumbnailImage,nil,YES);
if (photoWidth == TZScreenWidth || photoWidth == _photoPreviewMaxWidth) { if (photoWidth == TZScreenWidth || photoWidth == self->_photoPreviewMaxWidth) {
dispatch_async(dispatch_get_global_queue(0,0), ^{ dispatch_async(dispatch_get_global_queue(0,0), ^{
ALAssetRepresentation *assetRep = [alAsset defaultRepresentation]; ALAssetRepresentation *assetRep = [alAsset defaultRepresentation];
CGImageRef fullScrennImageRef = [assetRep fullScreenImage]; CGImageRef fullScrennImageRef = [assetRep fullScreenImage];
......
...@@ -652,8 +652,8 @@ ...@@ -652,8 +652,8 @@
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage needFetchAssets:!self.isFirstAppear completion:^(NSArray<TZAlbumModel *> *models) { [[TZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage needFetchAssets:!self.isFirstAppear completion:^(NSArray<TZAlbumModel *> *models) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
_albumArr = [NSMutableArray arrayWithArray:models]; self->_albumArr = [NSMutableArray arrayWithArray:models];
for (TZAlbumModel *albumModel in _albumArr) { for (TZAlbumModel *albumModel in self->_albumArr) {
albumModel.selectedModels = imagePickerVc.selectedModels; albumModel.selectedModels = imagePickerVc.selectedModels;
} }
[imagePickerVc hideProgressHUD]; [imagePickerVc hideProgressHUD];
...@@ -663,16 +663,16 @@ ...@@ -663,16 +663,16 @@
[self configTableView]; [self configTableView];
} }
if (!_tableView) { if (!self->_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; self->_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.rowHeight = 70; self->_tableView.rowHeight = 70;
_tableView.tableFooterView = [[UIView alloc] init]; self->_tableView.tableFooterView = [[UIView alloc] init];
_tableView.dataSource = self; self->_tableView.dataSource = self;
_tableView.delegate = self; self->_tableView.delegate = self;
[_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@"TZAlbumCell"]; [self->_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@"TZAlbumCell"];
[self.view addSubview:_tableView]; [self.view addSubview:self->_tableView];
} else { } else {
[_tableView reloadData]; [self->_tableView reloadData];
} }
}); });
}]; }];
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
if (_geocodeBlock && locations.count) { if (_geocodeBlock && locations.count) {
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:[locations firstObject] completionHandler:^(NSArray *array, NSError *error) { [geocoder reverseGeocodeLocation:[locations firstObject] completionHandler:^(NSArray *array, NSError *error) {
_geocodeBlock(array); self->_geocodeBlock(array);
}]; }];
} }
} }
......
...@@ -98,20 +98,20 @@ static CGFloat itemMargin = 5; ...@@ -98,20 +98,20 @@ static CGFloat itemMargin = 5;
[tzImagePickerVc showProgressHUD]; [tzImagePickerVc showProgressHUD];
} }
dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (!tzImagePickerVc.sortAscendingByModificationDate && _isFirstAppear && iOS8Later && _model.isCameraRoll) { if (!tzImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && iOS8Later && self->_model.isCameraRoll) {
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:YES completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:YES completion:^(TZAlbumModel *model) {
_model = model; self->_model = model;
_models = [NSMutableArray arrayWithArray:_model.models]; self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews]; [self initSubviews];
}]; }];
} else { } else {
if (_showTakePhotoBtn || !iOS8Later || _isFirstAppear) { if (self->_showTakePhotoBtn || !iOS8Later || self->_isFirstAppear) {
[[TZImageManager manager] getAssetsFromFetchResult:_model.result completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {
_models = [NSMutableArray arrayWithArray:models]; self->_models = [NSMutableArray arrayWithArray:models];
[self initSubviews]; [self initSubviews];
}]; }];
} else { } else {
_models = [NSMutableArray arrayWithArray:_model.models]; self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews]; [self initSubviews];
} }
} }
...@@ -125,7 +125,7 @@ static CGFloat itemMargin = 5; ...@@ -125,7 +125,7 @@ static CGFloat itemMargin = 5;
[self checkSelectedModels]; [self checkSelectedModels];
[self configCollectionView]; [self configCollectionView];
_collectionView.hidden = YES; self->_collectionView.hidden = YES;
[self configBottomToolBar]; [self configBottomToolBar];
[self scrollCollectionViewToBottom]; [self scrollCollectionViewToBottom];
...@@ -662,7 +662,7 @@ static CGFloat itemMargin = 5; ...@@ -662,7 +662,7 @@ static CGFloat itemMargin = 5;
} }
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) {
_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes]; self->_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
}]; }];
} }
...@@ -680,9 +680,9 @@ static CGFloat itemMargin = 5; ...@@ -680,9 +680,9 @@ static CGFloat itemMargin = 5;
} }
} }
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[_collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:item inSection:0] atScrollPosition:UICollectionViewScrollPositionBottom animated:NO]; [self->_collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:item inSection:0] atScrollPosition:UICollectionViewScrollPositionBottom animated:NO];
_shouldScrollToBottom = NO; self->_shouldScrollToBottom = NO;
_collectionView.hidden = NO; self->_collectionView.hidden = NO;
}); });
} else { } else {
_collectionView.hidden = NO; _collectionView.hidden = NO;
...@@ -748,20 +748,20 @@ static CGFloat itemMargin = 5; ...@@ -748,20 +748,20 @@ static CGFloat itemMargin = 5;
- (void)reloadPhotoArray { - (void)reloadPhotoArray {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) {
_model = model; self->_model = model;
[[TZImageManager manager] getAssetsFromFetchResult:_model.result completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {
[tzImagePickerVc hideProgressHUD]; [tzImagePickerVc hideProgressHUD];
TZAssetModel *assetModel; TZAssetModel *assetModel;
if (tzImagePickerVc.sortAscendingByModificationDate) { if (tzImagePickerVc.sortAscendingByModificationDate) {
assetModel = [models lastObject]; assetModel = [models lastObject];
if (assetModel.type != TZAssetModelMediaTypeVideo || tzImagePickerVc.allowPickingMultipleVideo) { if (assetModel.type != TZAssetModelMediaTypeVideo || tzImagePickerVc.allowPickingMultipleVideo) {
[_models addObject:assetModel]; [self->_models addObject:assetModel];
} }
} else { } else {
assetModel = [models firstObject]; assetModel = [models firstObject];
if (assetModel.type != TZAssetModelMediaTypeVideo || tzImagePickerVc.allowPickingMultipleVideo) { if (assetModel.type != TZAssetModelMediaTypeVideo || tzImagePickerVc.allowPickingMultipleVideo) {
[_models insertObject:assetModel atIndex:0]; [self->_models insertObject:assetModel atIndex:0];
} }
} }
...@@ -769,11 +769,11 @@ static CGFloat itemMargin = 5; ...@@ -769,11 +769,11 @@ static CGFloat itemMargin = 5;
if (tzImagePickerVc.allowCrop) { if (tzImagePickerVc.allowCrop) {
TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init]; TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
if (tzImagePickerVc.sortAscendingByModificationDate) { if (tzImagePickerVc.sortAscendingByModificationDate) {
photoPreviewVc.currentIndex = _models.count - 1; photoPreviewVc.currentIndex = self->_models.count - 1;
} else { } else {
photoPreviewVc.currentIndex = 0; photoPreviewVc.currentIndex = 0;
} }
photoPreviewVc.models = _models; photoPreviewVc.models = self->_models;
[self pushPhotoPrevireViewController:photoPreviewVc]; [self pushPhotoPrevireViewController:photoPreviewVc];
} else { } else {
[tzImagePickerVc.selectedModels addObject:assetModel]; [tzImagePickerVc.selectedModels addObject:assetModel];
...@@ -787,10 +787,10 @@ static CGFloat itemMargin = 5; ...@@ -787,10 +787,10 @@ static CGFloat itemMargin = 5;
[tzImagePickerVc.selectedModels addObject:assetModel]; [tzImagePickerVc.selectedModels addObject:assetModel];
[self refreshBottomToolBarStatus]; [self refreshBottomToolBarStatus];
} }
_collectionView.hidden = YES; self->_collectionView.hidden = YES;
[_collectionView reloadData]; [self->_collectionView reloadData];
_shouldScrollToBottom = YES; self->_shouldScrollToBottom = YES;
[self scrollCollectionViewToBottom]; [self scrollCollectionViewToBottom];
}]; }];
}]; }];
......
...@@ -175,10 +175,10 @@ ...@@ -175,10 +175,10 @@
_asset = asset; _asset = asset;
self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (![asset isEqual:_asset]) return; if (![asset isEqual:self->_asset]) return;
self.imageView.image = photo; self.imageView.image = photo;
[self resizeSubviews]; [self resizeSubviews];
_progressView.hidden = YES; self->_progressView.hidden = YES;
if (self.imageProgressUpdateBlock) { if (self.imageProgressUpdateBlock) {
self.imageProgressUpdateBlock(1); self.imageProgressUpdateBlock(1);
} }
...@@ -186,17 +186,17 @@ ...@@ -186,17 +186,17 @@
self.imageRequestID = 0; self.imageRequestID = 0;
} }
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
if (![asset isEqual:_asset]) return; if (![asset isEqual:self->_asset]) return;
_progressView.hidden = NO; self->_progressView.hidden = NO;
[self bringSubviewToFront:_progressView]; [self bringSubviewToFront:self->_progressView];
progress = progress > 0.02 ? progress : 0.02; progress = progress > 0.02 ? progress : 0.02;
_progressView.progress = progress; self->_progressView.progress = progress;
if (self.imageProgressUpdateBlock && progress < 1) { if (self.imageProgressUpdateBlock && progress < 1) {
self.imageProgressUpdateBlock(progress); self.imageProgressUpdateBlock(progress);
} }
if (progress >= 1) { if (progress >= 1) {
_progressView.hidden = YES; self->_progressView.hidden = YES;
self.imageRequestID = 0; self.imageRequestID = 0;
} }
} networkAccessAllowed:YES]; } networkAccessAllowed:YES];
...@@ -358,17 +358,17 @@ ...@@ -358,17 +358,17 @@
} }
[[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
_cover = photo; self->_cover = photo;
}]; }];
[[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) { [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
_player = [AVPlayer playerWithPlayerItem:playerItem]; self->_player = [AVPlayer playerWithPlayerItem:playerItem];
_playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player]; self->_playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];
_playerLayer.backgroundColor = [UIColor blackColor].CGColor; self->_playerLayer.backgroundColor = [UIColor blackColor].CGColor;
_playerLayer.frame = self.bounds; self->_playerLayer.frame = self.bounds;
[self.layer addSublayer:_playerLayer]; [self.layer addSublayer:self->_playerLayer];
[self configPlayButton]; [self configPlayButton];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:_player.currentItem]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:self->_player.currentItem];
}); });
}]; }];
} }
......
...@@ -510,7 +510,7 @@ ...@@ -510,7 +510,7 @@
- (void)showPhotoBytes { - (void)showPhotoBytes {
[[TZImageManager manager] getPhotosBytesWithArray:@[_models[_currentIndex]] completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:@[_models[_currentIndex]] completion:^(NSString *totalBytes) {
_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes]; self->_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
}]; }];
} }
......
...@@ -60,20 +60,20 @@ ...@@ -60,20 +60,20 @@
- (void)configMoviePlayer { - (void)configMoviePlayer {
[[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!isDegraded && photo) { if (!isDegraded && photo) {
_cover = photo; self->_cover = photo;
_doneButton.enabled = YES; self->_doneButton.enabled = YES;
} }
}]; }];
[[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) { [[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
_player = [AVPlayer playerWithPlayerItem:playerItem]; self->_player = [AVPlayer playerWithPlayerItem:playerItem];
_playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player]; self->_playerLayer = [AVPlayerLayer playerLayerWithPlayer:self->_player];
_playerLayer.frame = self.view.bounds; self->_playerLayer.frame = self.view.bounds;
[self.view.layer addSublayer:_playerLayer]; [self.view.layer addSublayer:self->_playerLayer];
[self addProgressObserver]; [self addProgressObserver];
[self configPlayButton]; [self configPlayButton];
[self configBottomToolBar]; [self configBottomToolBar];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:_player.currentItem]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:self->_player.currentItem];
}); });
}]; }];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment