我目前有一个非常奇怪的错误。
一个方法被调用,它应该通过停止它来隐藏一个 UIActivityIndicatorView
(启用停止时自动隐藏)和一个名为 badIndicator的
.UIImageView
作为替代,它应该显示另一个名为 goodIndicator
的 UIImageView
。
[goodIndicator setHidden:NO];
[badIndicator setHidden:YES];
[refreshIndicator stopAnimating];
NSLog(@"statussetting good should be completed");
控制台会立即打印以下内容,但大约需要三秒钟才能在屏幕上显示更改。
2013-05-31 20:24:57.835 app name[5948:1603] statussetting good should be completed
我已尝试在对象和父 View 上调用 setNeedsDisplay
方法,并将 hidden 替换为 alpha。
仍然遇到同样的问题。
最佳答案
听起来您是从后台线程调用它。所有与 UIKit
的交互都需要在主线程中发生。尝试使用:
dispatch_async(dispatch_get_main_queue(), ^{
[goodIndicator setHidden:NO];
[badIndicator setHidden:YES];
[refreshIndicator stopAnimating];
NSLog(@"statussetting good should be completed");
});
关于iphone - 设置隐藏 : has unwanted delay,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16863825/