Commit 694a0397 authored by krzhang's avatar krzhang

fix: 修复图片选择器HUD超时时间提前消失

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