iphone - 执行选择器 : withObject: afterDelay not executing for MBProgressHUD

标签 iphone objective-c ios ipad 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];

最佳答案

可能会尝试在主线程上执行选择器(所有 UI 更改都必须在主线程上完成)? performSelectorOnMainThread:

关于iphone - 执行选择器 : withObject: afterDelay not executing for MBProgressHUD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8810827/

相关文章:

ios - 在另一个 NSArray 中访问一个 NSArray 的信息

适合初学者的 iOS 布局

ios - SpriteKit : Should I pan the camera or move the background?

iphone - 具有特定时间间隔的IOS后台任务

iphone - 使用 AFJSONRequestOperation

iphone - 在 Xcode 中项目构建的链接阶段出现重复符号问题

ios - 将来自不同 TableViewController 的 4 个单元与单个 ViewController 链接

ios - 奇怪的核心数据行为(重复条目)

ios - swift 位置管理器

iphone - 在应用程序进入前台时刷新 View Controller 内容