Commit 3972a246 authored by yuzheng's avatar yuzheng

优化UIAlertController的dismiss

parent 825878c9
...@@ -196,7 +196,6 @@ ...@@ -196,7 +196,6 @@
#pragma mark - #pragma mark -
- (UIAlertController *)showAlertWithTitle:(NSString *)title; - (UIAlertController *)showAlertWithTitle:(NSString *)title;
- (void)hideAlertView:(UIAlertController *)alertView;
- (void)showProgressHUD; - (void)showProgressHUD;
- (void)hideProgressHUD; - (void)hideProgressHUD;
@property (nonatomic, assign) BOOL isSelectOriginalPhoto; @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
......
...@@ -419,11 +419,6 @@ ...@@ -419,11 +419,6 @@
return alertController; return alertController;
} }
- (void)hideAlertView:(UIAlertController *)alertView {
[alertView dismissViewControllerAnimated:YES completion:nil];
alertView = nil;
}
- (void)showProgressHUD { - (void)showProgressHUD {
if (!_progressHUD) { if (!_progressHUD) {
_progressHUD = [UIButton buttonWithType:UIButtonTypeCustom]; _progressHUD = [UIButton buttonWithType:UIButtonTypeCustom];
......
...@@ -472,8 +472,10 @@ static CGFloat itemMargin = 5; ...@@ -472,8 +472,10 @@ static CGFloat itemMargin = 5;
for (id item in photos) { if ([item isKindOfClass:[NSNumber class]]) return; } for (id item in photos) { if ([item isKindOfClass:[NSNumber class]]) return; }
if (havenotShowAlert) { if (havenotShowAlert) {
[tzImagePickerVc hideAlertView:alertView]; [alertView dismissViewControllerAnimated:YES completion:^{
[self didGetAllPhotos:photos assets:assets infoArr:infoArr]; alertView = nil;
[self didGetAllPhotos:photos assets:assets infoArr:infoArr];
}];
} }
} progressHandler:^(double progress, NSError * _Nonnull error, BOOL * _Nonnull stop, NSDictionary * _Nonnull info) { } progressHandler:^(double progress, NSError * _Nonnull error, BOOL * _Nonnull stop, NSDictionary * _Nonnull info) {
// 如果图片正在从iCloud同步中,提醒用户 // 如果图片正在从iCloud同步中,提醒用户
......
...@@ -484,21 +484,20 @@ ...@@ -484,21 +484,20 @@
photoPreviewCell.cropRect = _tzImagePickerVc.cropRect; photoPreviewCell.cropRect = _tzImagePickerVc.cropRect;
photoPreviewCell.allowCrop = _tzImagePickerVc.allowCrop; photoPreviewCell.allowCrop = _tzImagePickerVc.allowCrop;
photoPreviewCell.scaleAspectFillCrop = _tzImagePickerVc.scaleAspectFillCrop; photoPreviewCell.scaleAspectFillCrop = _tzImagePickerVc.scaleAspectFillCrop;
__weak typeof(_tzImagePickerVc) weakTzImagePickerVc = _tzImagePickerVc;
__weak typeof(_collectionView) weakCollectionView = _collectionView; __weak typeof(_collectionView) weakCollectionView = _collectionView;
__weak typeof(photoPreviewCell) weakCell = photoPreviewCell; __weak typeof(photoPreviewCell) weakCell = photoPreviewCell;
[photoPreviewCell setImageProgressUpdateBlock:^(double progress) { [photoPreviewCell setImageProgressUpdateBlock:^(double progress) {
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
__strong typeof(weakTzImagePickerVc) strongTzImagePickerVc = weakTzImagePickerVc;
__strong typeof(weakCollectionView) strongCollectionView = weakCollectionView; __strong typeof(weakCollectionView) strongCollectionView = weakCollectionView;
__strong typeof(weakCell) strongCell = weakCell; __strong typeof(weakCell) strongCell = weakCell;
strongSelf.progress = progress; strongSelf.progress = progress;
if (progress >= 1) { if (progress >= 1) {
if (strongSelf.isSelectOriginalPhoto) [strongSelf showPhotoBytes]; if (strongSelf.isSelectOriginalPhoto) [strongSelf showPhotoBytes];
if (strongSelf.alertView && [strongCollectionView.visibleCells containsObject:strongCell]) { if (strongSelf.alertView && [strongCollectionView.visibleCells containsObject:strongCell]) {
[strongTzImagePickerVc hideAlertView:strongSelf.alertView]; [strongSelf.alertView dismissViewControllerAnimated:YES completion:^{
strongSelf.alertView = nil; strongSelf.alertView = nil;
[strongSelf doneButtonClick]; [strongSelf doneButtonClick];
}];
} }
} }
}]; }];
......
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