我想在函数完成后几秒钟显示一个 UIActionSheet,这是用函数 B 完成的。
如果我这样做,效果很好:
main function
{
[self function A]
[self performSelector:@selector(function B) withObject:nil afterDelay:5];
}
但我使用 MBProgressHUD 作为活动指标:
main function
{
[HUD showWhileExecuting:@selector(funcion A) onTarget:self withObject:nil animated:YES];
[self performSelector:@selector(function B) withObject:nil afterDelay:5];
}
不起作用,函数 B 永远不会被调用。如果我将它切换到 [self function B] 它将被调用。我猜这是我还不明白的线程问题。如果我使用 [self performSelectorOnMainThread] 它将调用函数 B,但看起来我不能延迟那个。