Commit 3972a246 authored by yuzheng's avatar yuzheng

优化UIAlertController的dismiss

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