mrackwitz / MRProgress

Collection of iOS drop-in components to visualize progress
MIT License
2.55k stars 306 forks source link

ActivityView not rotating #47

Closed SaifAlDilaimi closed 10 years ago

SaifAlDilaimi commented 10 years ago

Hello Guys,

I got a issue over here. I have added a MRActivityIndicatorView and called the startAnimating method. The View is visible but its not rotating. It's just like this:

foto 15 06 14 20 22 07

But if I touch the home button and go back to the App it starts the animation.

mrackwitz commented 10 years ago

But if I touch the home button and go back to the App it starts the animation.

The startAnimating method has a side-effect, which changes the ivar _animating to the value YES, when you call it. This is thought, so that the CAAnimation can be re-added after backgrounding indicated by the state of the ivar. This explains this behavior.

So there has to be something, which doesn't alter the state, but removes the spin animation from the layer of the activity indicator view.

Do you have something in place, which could cause that the animation can't be added or is removed?

SaifAlDilaimi commented 10 years ago

I'm using facebooks pop framework in the same class. But i'm not sure which could effect that

mrackwitz commented 10 years ago

@deada92 Did you found yourself a solution for this problem? Otherwise I would need further information to help you with this issue.

SaifAlDilaimi commented 10 years ago

Unfortunately not, give me today some time. Didn't had time to debug it but I will today!

SaifAlDilaimi commented 10 years ago

Fixed it. I have to use the call in main thread:

dispatch_async(dispatch_get_main_queue(), ^{
    [self.loadingCircle startAnimating];
});
SaifAlDilaimi commented 10 years ago

Damn, what I wrote was working on iOS 8. On iOS 7 its not...

mrackwitz commented 10 years ago

You should always call startAnimating (and all other UI updates) on main queue. Can you please provide a minimal example to reproduce this issue?

SaifAlDilaimi commented 10 years ago

I fixed it. I had network traffic to my server in a background traffic. I did this to work on both OS:

dispatch_async(dispatch_get_main_queue(), ^{
    [self.loadingCircle startAnimating];
});

self.imageViewDelegate ? [self.imageViewDelegate didStartUploadingImage:self] : @"";

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    // Network traffic
});