Unverified Commit a044190a authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #1293 from ZhangCrow/fix_HUDTimeout

fix: 修复图片选择器HUD超时时间提前消失
parents 8aa2037f 694a0397
......@@ -33,6 +33,7 @@
/// Default is 4, Use in photos collectionView in TZPhotoPickerController
/// 默认4列, TZPhotoPickerController中的照片collectionView
@property (nonatomic, assign) NSInteger columnNumber;
@property (nonatomic, assign) NSInteger HUDTimeoutCount; ///< 超时隐藏HUD计数
@end
@implementation TZImagePickerController
......@@ -447,10 +448,15 @@
[self.view setNeedsLayout];
// if over time, dismiss HUD automatic
self.HUDTimeoutCount++;
__weak typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.timeout * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
strongSelf.HUDTimeoutCount--;
if (strongSelf.HUDTimeoutCount <= 0) {
strongSelf.HUDTimeoutCount = 0;
[strongSelf hideProgressHUD];
}
});
}
......
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