I have progress indicator that keeps track of some process. When the application moves from the background to the foreground I can see the progress animation jumping from its old position to the current value. I don't quite like it, so I was wondering if it was possible to update the progress to its current state just before the app becomes active?
Asked
Active
Viewed 329 times
0
-
Have you tried to use `applicationWillEnterForeground` ? – fiks Jul 19 '16 at 15:46
-
I am not sure what to put in there since the code for the progress run in a separate file – irkinosor Jul 19 '16 at 15:56
-
You can use NSNotificationCenter to send a notification to your object. – fiks Jul 19 '16 at 16:05
-
While still working in the background, send the UI refresh commands on the main thread via dispatch. – Eric Aya Jul 19 '16 at 16:08
-
Guys code example will be appreciated. But thanks for the pointers – irkinosor Jul 19 '16 at 16:11
-
Simple code example: http://stackoverflow.com/a/28321213/2227743 The code you put *inside* this dispatch, while being in the background, will be executed on the main thread. – Eric Aya Jul 19 '16 at 16:14
-
I tried that method already, you still see the text jumping from its old value to the new value – irkinosor Jul 19 '16 at 16:59
1 Answers
0
I know this is late but as no one else has said it I'll chime in.
Probably what you're seeing is this situation is the snapshot of your app that was taken when it went to the background (at the old progress) being displayed while it's being brought back to the foreground. Then it starts rendering your app again and snaps to the new progress.
What you could do is not jump straight to your new progress but animate it once the app has come to the foreground, then it would be a smoother transition.

CMash
- 1,987
- 22
- 35