UIActivityIndi​​cator工作不正常? [英] UIActivityIndicator not working properly?

查看:70
本文介绍了UIActivityIndi​​cator工作不正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于UIActivityIndi​​cator的问题。我在IBAction上的一个按钮上应用了 [spinner startAnimating] ,然后进行了一些处理。应该停止进程activityindicator然后导航到另一个视图。但活动指标不会出现。当我删除[spinner stopAnimating]行时,指示符会出现,但不会按下即时按钮。它出现在其他视图加载之前,显然没有出现,我的意思是它没有出现但是如果我们非常仔细地看到它只会立即出现。

I have a problem regarding UIActivityIndicator. I applied [spinner startAnimating] at the IBAction on a button and then doing some process. After the process activityindicator should be stopped and then navigate to another view. But the activity indicator does not appear. When I remove the line "[spinner stopAnimating]" then the indicator appears but not at the instant button is pressed. It appears just before the other view loads, and apparently does not appear, I mean it does not appear but if we see very carefully then only it appears for an instant.

对于任何答案都提前完成。

Thanx in advance for any answer.

推荐答案

Ole非常正确,但有一个技巧你不介意同步处理(通常是为什么你想首先显示活动指示器)。

Ole is pretty much correct, but there is a trick of you don't mind synchronous processing (often that it why you want to display the activity indicator in the first place).

首先移动你想要处理的代码,同时微调器到达它的自己的方法。然后执行

First move your code that you want to process while the spinner is up to its own method. Then do

[spinner startAnimating];
[self performSelector:@selector(methodname) withObject:nil afterDelay:0];

afterDelay:0表示下次通过运行循环。这样微调器开始了。

The afterDelay:0 means on the next time through the run loop. That way the spinner gets started.

这篇关于UIActivityIndi​​cator工作不正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆