WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Circular Animation not showing when app comes back to the foreground.

Forums > iOS

I'm building a timer app with UIKit that has a circular animation. I'm using CABasicAnimation for the circular animation. Presently, when the app goes to the background, the timer and animation are supposed to pause. The timer pauses alright, and when the app is brought back to the foreground, I can tap the resume button to continue the timer countdown. The challenge I'm having is that the circular animation does not reappear when the app comes back to the foreground. Please does anyone have any ideas how I can make the animation reappear when the app comes back to the foreground, so when I press the resume button, both the animation and timer continue?

   

Hello! I finally found a solution to the challenge above. Just in case anyone has a similar issue in the future, this stackoverflow thread has the solution: https://stackoverflow.com/questions/7568567/restoring-animation-where-it-left-off-when-app-resumes-from-background

   

Excellent. Thanks for posting a solution.

It might help others if you explained the general problem, then the coding approach that solved the issue.

Please be sure to mark your answer as SOLVED!

   

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.