Skip to content

Commit a044190

Browse files
authored
Merge pull request #1293 from ZhangCrow/fix_HUDTimeout
fix: 修复图片选择器HUD超时时间提前消失
2 parents 8aa2037 + 694a039 commit a044190

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

TZImagePickerController/TZImagePickerController/TZImagePickerController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ @interface TZImagePickerController () {
3333
/// Default is 4, Use in photos collectionView in TZPhotoPickerController
3434
/// 默认4列, TZPhotoPickerController中的照片collectionView
3535
@property (nonatomic, assign) NSInteger columnNumber;
36+
@property (nonatomic, assign) NSInteger HUDTimeoutCount; ///< 超时隐藏HUD计数
3637
@end
3738

3839
@implementation TZImagePickerController
@@ -447,10 +448,15 @@ - (void)showProgressHUD {
447448
[self.view setNeedsLayout];
448449

449450
// if over time, dismiss HUD automatic
451+
self.HUDTimeoutCount++;
450452
__weak typeof(self) weakSelf = self;
451453
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.timeout * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
452454
__strong typeof(weakSelf) strongSelf = weakSelf;
453-
[strongSelf hideProgressHUD];
455+
strongSelf.HUDTimeoutCount--;
456+
if (strongSelf.HUDTimeoutCount <= 0) {
457+
strongSelf.HUDTimeoutCount = 0;
458+
[strongSelf hideProgressHUD];
459+
}
454460
});
455461
}
456462

0 commit comments

Comments
 (0)