iPhone - 加载活动指示器

发布于 2024-08-05 02:37:08 字数 353 浏览 2 评论 0原文

我知道我的问题,但找不到解决方案。当按下按钮时,它会告诉 UIActivityIndi​​catorView 开始 Aminate 并从 XML feed 中检索数据。我遇到的问题是它在开始加载器动画之前运行整个事件,因此加载器在检索数据之前永远不会旋转。如何启动加载程序的动画,然后在启动后继续从 XML 提要获取数据?

-(IBAction)getXMLData {
    [loader startAnimating];

    [self retrieveXML];
}
. 
. code
. more code
.
-(void)retrieveXMLEnded {
   [loader stopAnimating];
}

I am aware of my problem but cannot find a solution. When the button is pressed it tells the UIActivityIndicatorView to startAminating and also retrieve data from a XML feed. Problem I am having is it runs the whole event before starting the animating of the loader, so the loader never spins before the data is retrieved. How can I start the loader's animation and then once it has started continue with getting data from the XML feed?

-(IBAction)getXMLData {
    [loader startAnimating];

    [self retrieveXML];
}
. 
. code
. more code
.
-(void)retrieveXMLEnded {
   [loader stopAnimating];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜司空 2024-08-12 02:37:08

在其他线程中启动动画

[loader performSelectorInBackground: @selector(startAnimating) withObject: nil];

Strart animation in other thread

[loader performSelectorInBackground: @selector(startAnimating) withObject: nil];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文