eugene
eugene

Reputation: 41665

(iphone) show custom activity indicator?

I've made a custom activity indicator (actually 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

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

Upvotes: 0

Views: 597

Answers (2)

Vinzius
Vinzius

Reputation: 2901

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.

Upvotes: 1

Matthias Bauch
Matthias Bauch

Reputation: 90117

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.

Upvotes: 0

Related Questions