PerformSelector:withObject:afterDelay 未针对 MBProgressHUD 执行
我对 MBProgressHUD 有以下方法:
[progressHUD performSelector:@selector(hide:)
withObject:[NSNumber numberWithBool:YES]
afterDelay:kMessageHidingDelay];
此处的延迟为 2.0,但在 2.0 秒后不会调用 hide。我试图在隐藏函数中放置一个断点,但它没有到达那里。有什么想法吗?这是完整的代码:
progressHUD = [[MBProgressHUD alloc] initWithView:viewToAttach];
// Add HUD to screen
[viewToAttach addSubview:progressHUD];
progressHUD.labelText = @"Logging In";
progressHUD.removeFromSuperViewOnHide = YES;
// Show the HUD while the provided method executes in a new thread
[progressHUD show:YES];
I have the following method for a MBProgressHUD:
[progressHUD performSelector:@selector(hide:)
withObject:[NSNumber numberWithBool:YES]
afterDelay:kMessageHidingDelay];
the delay is 2.0 here, however it's not calling hide after 2.0 seconds. I tried to put a breakpoint in the hide function and it's not getting there. Any idea? Here's the full code:
progressHUD = [[MBProgressHUD alloc] initWithView:viewToAttach];
// Add HUD to screen
[viewToAttach addSubview:progressHUD];
progressHUD.labelText = @"Logging In";
progressHUD.removeFromSuperViewOnHide = YES;
// Show the HUD while the provided method executes in a new thread
[progressHUD show:YES];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能会尝试在主线程上执行选择器(所有 UI 更改都必须在主线程上完成)?
performSelectorOnMainThread:
May be try to perform selector on Main thread (all UI changes must be done on main thread)?
performSelectorOnMainThread:
你必须隐藏
MBProgressHud
you have to hide the
MBProgressHud
要显示 MBProgressHUD,请使用此代码:-
并且隐藏 MBProgressHud
,如果您想在 CostomView 中显示 Hud,请使用此代码
}
To Show MBProgressHUD Use this Code:-
And too Hide the MBProgressHud
And If you Want to Show Hud With Your CostomView Then Use This Code
}