开发者

(iphone) show custom activity indicator?

开发者 https://www.devze.com 2023-02-17 04:27 出处:网络
I\'ve made a custom activity indicator (actually开发者_Go百科 just an imageView) When user clicks something and I expect it will take a bit long to process(alloc a UIViewController and push on to nav

I've made a custom activity indicator (actually开发者_Go百科 just an imageView)

When user clicks something and I expect it will take a bit long to process(alloc a UIViewController and push on to navigation stack),

I alloc the indicator and add it as subview of current view just before the lengthy process starts.

Strange thing is, indicator doesn't show up until the push (left-right) animation starts.

Is it because the lengthy job takes the system, and ui drawing for activity indicator is delayed?

Am I doing something wrong here?

Thank you

  • Edit

Looks like I can do the "push" in background.. i'm trying it now IPhone SDK - Leaking Memory with performSelectorInBackground


Is your job synchrone or asynchrone ?

If it's the first case, then it can be the problem.

Check all the method like :

[ self performSelector:<#(SEL)aSelector#> ];

You can thread this to avoid your [potential] problem.

Good luck.


You should process your lengthy tasks in the background. The UI won't update if you block the main thread.

So you have to refactor your app, the alloc and push of the viewController should happen within the blink of an eye, because you can't do this in the background.

But you can do the processing (downloading data I guess) in the background.

There is plenty information available about background processing. The way to go varies heavily on what you want to do exactly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号