对于MBProgressHUD,我有以下方法:

 [progressHUD performSelector:@selector(hide:)
                   withObject:[NSNumber numberWithBool:YES]
                   afterDelay:kMessageHidingDelay];


这里的延迟是2.0,但是在2.0秒后它没有调用hide。我试图在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 - performSelector:withObject:afterDelay对于MBProgressHUD不执行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8810827/

10-15 11:56