开发者

NStimer countdown shows old time when app reopens - iphone taking image of screen?

开发者 https://www.devze.com 2023-01-27 02:10 出处:网络
I have some strange behavior in my iphone app. I have an NSTimer which counts down. When the app closes, I save the time and subtract that from the current countdown timer when the app reopens.

I have some strange behavior in my iphone app. I have an NSTimer which counts down. When the app closes, I save the time and subtract that from the current countdown timer when the app reopens.

Say I close the app at 03:12 (3 mins 12 seconds). I reopen the app and my code (in app delegate) subtracts the closed time (say 5 seconds) and will then set the countdown label again. It sets it to 03:07.

However, the strange behavior is that when I reopen the app is 开发者_Go百科says 03:12 for a SPLIT second before it updates to 03:07. Yet, I cannot find ANYWHERE where it would be setting an old time.

So, my question is that does the view retain the label value until next time it loads, or is it (as I heard) that the iphone takes an image of the screen so when the app loads next time it looks like it's loading quicker. If this is right, is there a way to stop that??

I'm stuck with this one!!


My understanding is that iOS generates a snapshot of your key window before backgrounding your app, then uses that to display the foregrounding animation. I believe this is done for performance reasons.

An easy way out would be to simply hide your label in the applicationWillResignActive: method of your app delegate and then update and show it again in your applicationWillEnterForeground: method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号