gpt4 book ai didi

iphone - 设置隐藏 : has unwanted delay

转载 作者:可可西里 更新时间:2023-11-01 06:19:43 26 4
gpt4 key购买 nike

我目前有一个非常奇怪的错误。

一个方法被调用,它应该通过停止它来隐藏一个 UIActivityIndi​​catorView(启用停止时自动隐藏)和一个名为 badIndicator UIImageView.

作为替代,它应该显示另一个名为 goodIndicatorUIImageView

[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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com