我正在使用M13ProgressHUD在我的应用程序中显示一个加载器。它的功能很好,但是如果我在加载器打开的时候将我的应用程序切换到后台,再返回前台,加载器会被冻结。为什么会发生这种情况?
我添加hud的方式是:
_hud = [[M13ProgressHUD alloc] initWithProgressView:[[M13ProgressViewRing alloc] init]];
_hud.progressViewSize = CGSizeMake(60.0, 60.0);
_hud.animationPoint = CGPointMake([UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.height / 2);
_hud.indeterminate = YES;
_hud.primaryColor = [UIColor whisperRed];
_hud.secondaryColor = [UIColor whisperRed];
((M13ProgressViewRing*)_hud.progressView).backgroundRingWidth = 2.0;
_hud.maskType = M13ProgressHUDMaskTypeSolidColor;
UIWindow *window = ((AppDelegate *)[UIApplication sharedApplication].delegate).window;
[window addSubview:_hud];
并将其显示为:
dispatch_async(dispatch_get_main_queue(), ^{
// Show an activity indicator
[_hud performAction:M13ProgressViewActionNone animated:YES];
[_hud setStatus:@"Connecting via Facebook"];
[_hud setIndeterminate:YES];
[_hud show:YES];
});
为什么当应用程序回到前台时会出现卡顿,即使我已将其添加到主队列中?