Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you go to another screen, and then return, the animation will be stopped! #4

Closed
Krusheuski opened this issue Jun 28, 2017 · 8 comments
Labels

Comments

@Krusheuski
Copy link

If you go to another screen, and then return, the animation will be stopped, although isAnimating == yes.

@justindhill
Copy link
Owner

Hi @Krusheuski, thanks for the bug report. I'll take a look at this when I get some time.

@pixelmatrix
Copy link

I've also come across this issue. It seems like what happens is that when the view is off screen but still retained in memory, the CAAnimations get removed, so the isAnimating property is out of sync. The state issue could be solved by returning isAnimating dynamically based on the presence of the animation keys.

I haven't found a workaround inside the spinner component itself, but in my view controller I am iterating through all the spinners and calling startAnimating() again. There is a slight side effect however, which is that it starts at the first color rather than the current color.

@justindhill it would be nice if we could get startAnimating() to continue from the current state (rotation and color)

@justindhill
Copy link
Owner

Hey @pixelmatrix, those are both great ideas. Resuming from the last color is very easy and I have some ideas about how I could accomplish resuming the rotation from the existing state. Could you please file that as a separate ticket?

@justindhill
Copy link
Owner

Also @pixelmatrix I was thinking the ideal solution would be to actually resume animating when the view is re-added to a window. It seems more in-line with the intent of the API consumer.

@Krusheuski
Copy link
Author

@pixelmatrix My indicators are in the cells. And now I have to reload the table cells after returning to the screen to start startAnimation. :(

@justindhill
Copy link
Owner

Hey @Krusheuski - I just pushed up v1.3.1 to CocoaPods this morning. It should fix the immediate problem of the spinner being out of sync with the isAnimating property. DRPLoadingSpinner now simply starts the animation again when it is re-added to the window. For the moment, it does not resume the state of the animation that it had when it was removed from the window, but I will work on this when I get some time. I am also open to PRs that address the problem.

@Krusheuski
Copy link
Author

@justindhill thx

@justindhill
Copy link
Owner

Looks like @pixelmatrix opened another issue for resuming from the spinner's prior state, so I'm going to close this one as the immediate problem is solved. We can continue discussion in #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants